I'm using the following BASH mysql statement to get data from my DB.
mysql -N -u root --password=ROOT DB -h 127.0.0.1 -e "SELECT * FROM site where id like '1234'" | while read A B C D E F G H I J K L M N O P Q R S T U V W X Y Z; do
echo $A
echo $B
done
To get all the values for A to Z this seems a long winded way.
How can I do this better and create variables based on the read value name and results. ?
eg:
create var A which contains value of $A and do this all the way upto var Z containing the value of $Z
This is only an example, the values won't be called A-Z, but have proper names. Is there any way to create variable based on the true proper name and then associate the value to it ?
eg:
mysql -N -u root --password=ROOT DB -h 127.0.0.1 -e "SELECT * FROM site where id like '1234'" | while read site_id site_location site_size etc.......; do