#!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`