LinuxQuestions.org
Visit Jeremy's Blog.
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 11-11-2009, 07:01 PM   #1
Corrado
Member
 
Registered: Aug 2004
Location: Washington
Distribution: RHEL
Posts: 174

Rep: Reputation: 16
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
 
Old 11-11-2009, 07:14 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,418

Rep: Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785Reputation: 2785
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
 
Old 11-11-2009, 07:21 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by Corrado View Post
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
 
Old 11-11-2009, 07:44 PM   #4
Corrado
Member
 
Registered: Aug 2004
Location: Washington
Distribution: RHEL
Posts: 174

Original Poster
Rep: Reputation: 16
Thanks Tink. the quotes did the trick.
 
  


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
echo and cat command rdpatel55 Linux - General 0 05-26-2009 06:42 AM
more information about echo command shuchi Linux - Newbie 9 04-18-2009 07:15 AM
echo command s_hcl Linux - General 1 09-06-2006 06:27 AM
what is the echo command in perl? hamish Programming 5 12-14-2004 09:31 AM
echo command peculiarity eallen Linux - General 3 02-11-2003 06:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:44 AM.

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
Open Source Consulting | Domain Registration