LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Command echo (https://www.linuxquestions.org/questions/linux-newbie-8/command-echo-768529/)

Corrado 11-11-2009 06:01 PM

Command echo
 
I am trying to get echo to work with ssh and am having no luck in getting it to do what I want. I want to be able to ssh into a box and echo text to a file that doesn't yet exist.

ssh isn't an issue because when I substitute echo with "ls", it returns a listing. But when using echo, a file is never created. Here's what I have....

Quote:

ssh server1 echo text >> /root/newfile
Why does echo not like this and what is the work arround to this?

Chris

chrism01 11-11-2009 06:14 PM

I'd be interested to know what actually happens, do you get an error msg? In any case, I'd recommend using single quotes (') around the entire cmd http://bashcurescancer.com/run_remot..._with_ssh.html

Tinkster 11-11-2009 06:21 PM

Quote:

Originally Posted by Corrado (Post 3753538)
I am trying to get echo to work with ssh and am having no luck in getting it to do what I want. I want to be able to ssh into a box and echo text to a file that doesn't yet exist.

ssh isn't an issue because when I substitute echo with "ls", it returns a listing. But when using echo, a file is never created. Here's what I have....

Code:

ssh server1 echo text >> /root/newfile
Why does echo not like this and what is the work arround to this?

Chris


Try

Code:

ssh server1 "echo text >> /root/newfile"
Your redirect ends up on the local box.


Cheers,
Tink

Corrado 11-11-2009 06:44 PM

Thanks Tink. the quotes did the trick.


All times are GMT -5. The time now is 11:39 AM.