[colug-432] Bash fun

Tom Hanlon tom at functionalmedia.com
Sun Nov 1 11:02:09 EST 2009


I am writing a script that takes a file of MySQL queries. I want to  
read that file and then run explain for each query in the file and  
gather a subset of the output generated.

So basic process is.

given file

select this from that;
select that from this;

I want to run

mysql -u user -ppass -e "explain select this from that" >>file.out.
mysql -u user -ppass -e "explain select that from this" >>file.out.

I am reading the lines from the file.. no problem, I am assigning them  
to variables.

The exec, or eval or whatever it takes to fork a process and keep on  
going is holding me up a little bit.

while read line
echo  $line;
# exec seems to exit
## exec who;



More information about the colug-432 mailing list