#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2005
    Posts
    4
    Rep Power
    0

    Need help with rsh command


    Hello,

    I'm writing a simple script that does this.

    By the way, I"m on hostA.

    rsh hostB | cat /etc/passwd

    It works on a command line but when I put in the command into a script it outputs /etc/passwd on hostA -> the host that I am on.

    Can you assist?

    Thanks
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2005
    Posts
    4
    Rep Power
    0
    sorry the actual command is:

    rsh hostB cat /etc/passwd

    without the |

    Works fine alone but if I put into the script it gives me the /etc/passwd of where the script ones.

    Thanks.

    Originally Posted by rmslayer
    Hello,

    I'm writing a simple script that does this.

    By the way, I"m on hostA.

    rsh hostB | cat /etc/passwd

    It works on a command line but when I put in the command into a script it outputs /etc/passwd on hostA -> the host that I am on.

    Can you assist?

    Thanks
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    844
    Rep Power
    387

    Cool


    Try:
    Code:
    rsh hostB "cat /etc/passwd"
    Last edited by LKBrwn_DBA; May 2nd, 2011 at 09:45 PM.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,442
    Rep Power
    1688
    Really should not be using the remote commands if you can help it! Unless there is a good reason you should look into using the OpenSsh stuff, such as ssh and scp, etc.
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo