Find the answer to your Linux question:
Results 1 to 2 of 2
I have a script that when run eventually connects to another computer and gives me a new prompt (via rsh I think). From that prompt I ssh into yet another ...
  1. #1
    Just Joined!
    Join Date
    Jun 2007
    Posts
    5

    Execute multiple commands in muliple shells

    I have a script that when run eventually connects to another computer and gives me a new prompt (via rsh I think). From that prompt I ssh into yet another box to give me a third prompt. I have given a short example of the process I go through.

    Code:
    prompt0$ special-script
     Connecting to server...
    prompt1$ ssh -l user server2
    password: 
    prompt2$
    What I would like to do is automate this a bit with an alias or something similar. I have tried to create a alias like this:

    Code:
    alias command='special-script; ssh -l server2'
    When I do this it gets me to the second prompt (prompt1 in my example) but never executes the second command. When I exit out of that prompt it then executes the second command, which I don't want and won't work.

    Does anyone know how I can use an alias to make this happen? Just as a side note, I am still wanting to type in my password. Thanks.

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Are you able to modify the special script?

    The problem is that any commands that are run after the special script will be run on the local host. However, if you check the ssh man page, you will see that you can specify a command for ssh to run on the remote host. I don't know anything about rsh or what it is, but try to connect to the remote host and run the new ssh command in the same ssh/rsh command in the special script.

    Does this make sense?
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...