LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-26-2014, 11:49 AM   #1
mj8570
LQ Newbie
 
Registered: Feb 2014
Posts: 2

Rep: Reputation: Disabled
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
 
Old 02-26-2014, 01:15 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
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"
 
1 members found this post helpful.
Old 02-27-2014, 10:55 AM   #3
mj8570
LQ Newbie
 
Registered: Feb 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you very much pingu!

Use of escape (\) preceding character for (") and ($) has solved the issue.

Regards,

- Sharath
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Running command in gnome-terminal from script results in "...error creating child..." PlancksCnst Linux - General 6 04-08-2009 12:09 PM
LFS6.3 livecd "ls : command not found" error after "su - lfs" rotu Linux From Scratch 2 06-19-2008 03:59 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
"Successful install" results in "Boot device not found" slackr007 Fedora 2 06-21-2005 04:05 PM
"Successful install" results in "Boot device not found" slackr007 Linux - Newbie 2 05-31-2005 08:02 PM


All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration