While loop in SSH command
I am having trouble getting the while loop to execute in the ssh command:
ssh $USERID@serverX "while read line do echo $line done<$list_dir/cost_feed.lst.old" Error: bash: -c: line 1: syntax error: unexpected end of file I have managed to use simpler commands with ssh like: ssh $USERID@serverX "pwd; cp x y" I expect that I need to add some combination of escape characters or semicolons, but if anyone can point me in the right direction, i would appreciate it. |
You need a couple semicolons in the right places:
Code:
ssh $USERID@serverX "while read line; do echo $line; done<$list_dir/cost_feed.lst.old" |
I'd also change the double quotes with single quotes to protect the $ sign from the local shell.
|
Thanks, that worked.
|
All times are GMT -5. The time now is 12:02 AM. |