Results 1 to 2 of 2
Can someone please tell me, why I'm getting an error mesg while trying to run the rsh command using a variable "a" and not getting an error mesg, when firing ...
- 07-23-2007 #1
rsh multicommand issue
Can someone please tell me, why I'm getting an error mesg while trying to run the rsh command using a variable "a" and not getting an error mesg, when firing the same command (stored inside variable "a" on $ prompt)..................??? Do i need to export any variables or do a "cd" inside..!!!!
Code:[/Fare/loggers/build] $ echo $c1; echo $c2; echo `hostname` hostname -s hostname -i e1d1nas10.somecompany.com [Fare/loggers/build] $ a="rsh -l build 53.3.101.185 \"$c1 ;$c2\"" [/Fare/loggers/build] $ echo $a rsh -l build 53.3.101.185 "hostname -s ;hostname -i" [/Fare/loggers/build] $ $a bash: hostname -s ;hostname -i: command not found [/Fare/loggers/build] $ `$a` bash: hostname -s ;hostname -i: command not found [/Fare/loggers/build] $ rsh -l build 53.3.101.185 "$c1 ;$c2" e1d1nas10 53.3.101.185
- 07-24-2007 #2Linux Engineer
- Join Date
- Feb 2005
- Posts
- 1,044
It's because the double quotes aren't being seen by your shell so the quoted string is appearing to rsh as a single command with embedded spaces. Try executing the variable with eval and see the difference! - $ eval $a


Reply With Quote