variable substitution results in "command not found" error
find /data/backup/ -name 20140202* -exec awk -F"|" '$23!=0 {print"|"$14"|"$23}' {} \; > Day1.txt
host='XX.XX.XX.XX' user='root' passwd='root' ( echo "$user" echo "$passwd" echo "cd /data/" echo "find /data/backup/ -name rec20140202* -exec awk -F"|" '$23!=0 {print"|"$14"|"$23}' {} \; > Day2.txt" echo "exit" )| telnet "$host" =========================== in the above code fragment second find command ( inside telnet part)is not working. I am getting an error as below =========================== server2:/data # testnew.sh: line 27: '3!=0 {print: command not found testnew.sh: line 27: 4: command not found testnew.sh: line 27: 3: command not found testnew.sh: line 27: }' {} \; > Day2.txt: command not found Connection closed by foreign host. Pls help |
Look carefully at that line, check the double-quotes!
What you want is to wrap the whole line in double-quotes, but actually the first enclosed is "find /data/backup/ -name rec20140202* -exec awk -F" |
Thank you very much pingu!
Use of escape (\) preceding character for (") and ($) has solved the issue. Regards, - Sharath |
All times are GMT -5. The time now is 10:15 PM. |