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 ...
- 04-29-2009 #1Just 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.
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:prompt0$ special-script Connecting to server... prompt1$ ssh -l user server2 password: prompt2$
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.Code:alias command='special-script; ssh -l server2'
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.
- 04-29-2009 #2
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


Reply With Quote