1845895 Members
4762 Online
110250 Solutions
New Discussion

Re: remsh command

 
Nisar Ahmad
Regular Advisor

remsh command

Hi There

I want to append some text to the file on a remort server and tried the following but does not work. Any better idea please ?

ID="Testing"
remsh SERVER /usr/bin/echo $ID >> FILE

Thanks in advance

Nisar
5 REPLIES 5
Hemmetter
Esteemed Contributor

Re: remsh command

Hi Nisar

have a look at remsh(1):
Section "EXAMPLES:

Shell metacharacters that are not quoted are interpreted on the local
host; quoted metacharacters are interpreted on the remote host. Thus
the command line:

remsh otherhost cat remotefile >> localfile

appends the remote file remotefile to the local file localfile, while
the command line

remsh otherhost cat remotefile ">>" otherremotefile

appends remotefile to the remote file otherremotefile.




rgds
HGH
Peter Nikitka
Honored Contributor

Re: remsh command

Hi,

another possible solution:
ID="Testing"
remsh SERVER "/usr/bin/echo $ID >> FILE"

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
LucaVentura
New Member

Re: remsh command

if you want the file on your local machine instead you can try

ID="Testing"
remsh SERVER "/usr/bin/echo $ID" >> FILE
Nisar Ahmad
Regular Advisor

Re: remsh command

Hi There

I want loacl variable ID to be appended to remote file.

Thanks
Peter Nikitka
Honored Contributor

Re: remsh command

Hi,

>>
I want loacl variable ID to be appended to remote file.
<<

That is EXACTLY what my above solution does!

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"