[colug-432] Bash fun

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


Colug,

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.

#!/bin/bash
while read line
do
echo  $line;
######
# exec seems to exit
#
## exec who;
done



Thanks,

Tom 


More information about the colug-432 mailing list