I want to run a few sql queries via the command line and I have the queries in a file called query.txt. I want to read query from file and execute the query.
I have a script to run sql queries in general and it works find:
spawn mysql -u root -p
send -- "vm1234\r"
send -- "\r"
send "use homo_sapiens_core_70_37\r"
send "select avg(feature_id) from homo_sapiens_core_70_37.supporting_feature;\r"
and I have another script to read queries from the file:
while read line
But when I combine them I will get errors, I know one of them is /bin/expect and the other one has /bin/sh and probably this is causing the error, but I do not know how to change the code.
Any help is really really appreciated.