I have written a shell script to execute my data base query
mysql -uroot -pshruti2 -B -e "use WebNmsDB;select HEADERINDEX from tekelec_meas_headers where CLLI=$clli and IVALSTART>="$ivalstart" and IVALSTART<"$ivalend" and RPTTYPE="$rpttype";" > win.txt
But the output in win.txt is
/mysql Ver 14.12 Distrib 5.0.44, for unknown-linux-gnu (x86_64) using EditLine wrapper
Copyright (C) 2002 MySQL AB
This is commercial software, and use of this software is governed
by your applicable license agreement with MySQL
Usage: /Tekelec/WebNMS/mysql/bin/mysql [OPTIONS] [database]
where is it going wrong?
Use '$var'
instead of "$var"
. You should only use double quotes to open and close the MYSQL command.
The command will now look like this:
mysql -uroot -pshruti2 -B -e "use WebNmsDB;select HEADERINDEX from tekelec_meas_headers where CLLI=$clli and IVALSTART>='$ivalstart' and IVALSTART<'$ivalend' and RPTTYPE='$rpttype'" > win.txt
One last thing: If I'm not mistaken, you don't need the last semicolon as it's only used to separate several commands and not to finish them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.