I need a variable to hold results retrieved from the database. So far this is basically what I\'m trying with no success.
myvariable=$(mysql database -u $use
To read the data line-by-line into a Bash array you can do this:
while read -a row
do
echo "..${row[0]}..${row[1]}..${row[2]}.."
done < <(echo "SELECT A, B, C FROM table_a" | mysql database -u $user -p $password)
Or into individual variables:
while read a b c
do
echo "..${a}..${b}..${c}.."
done < <(echo "SELECT A, B, C FROM table_a" | mysql database -u $user -p $password)