#!bin/bash

mysql -u user --password=password << eof

use mydatabase;
SELECT version FROM versions WHERE versionid = 'LIST';


eof

I'd like to get the value from the query into a variable. Any ideas how I could do that?

#!bin/bash

mysql -u user --password=password << eof

use mydatabase;
SELECT version FROM versions WHERE versionid = 'LIST';


eof

I'd like to get the value from the query into a variable. Any ideas how I could do that?

Actually I kinda figured it out:

variable=`
mysql -u user --password=password << eof

use mydatabase;
SELECT version FROM versions WHERE versionid = 'LIST';


eof`
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.