Hi,
I need to run sql query in shell script after getting connected to ssh. For that I connected to ssh through shell script using RSA keys [done]. Now when I am running sql query, it's not working... but several other commands like 'ls'. 'mkdir', etc are working properly.
Here is my code:
query="select status, count\(*\) from transact\;"
ssh user@ip <<FILE
# All commands working in this line
echo "hello"; ls; mkdir newfolder; echo $query
# sql command is not working
print $query | sql
exit
FILE
echo "DONE!!"
Also the same line " print $query | sql " works on command line after being connected to ssh.
I am getting these errors:
(1) stty: : Invalid argument
stty: : Invalid argument
stty: : Invalid argument
ksh[3]: sql: not found
please help.
Thanks.