ssh in bash script
Thomas Cameron
thomas.cameron at camerontech.com
Tue Apr 5 15:21:25 UTC 2005
On Tue, 2005-04-05 at 15:08 +0000, rado wrote:
> hi guys!
> ssh already keyed for passwordless.
> from shell prompt I can:
>
> # ssh host2
>
> the shell in host 2 is spawned and am now at host2's prompt.
>
> # run command
> I want the exit code from what I just ran
>
> # exit
> back at prompt in host1.
>
> that's it! cake huh?
>
> ok in a script:
>
> it stops at the prompt as soon as it spawns the shell in host 2
>
> how to make it continue on in the script?
>
> also, since it's virgin territory for me.
>
> can I indeed just capture the exit code for a return value that I can
> pass on to the calling script, or if I decide, just to write the code
> inside the main script?
ssh user at host "command"
user is your username on the remote host.
host is the host you are logging into.
"command" is a single or multiple commands you want run on the remote
host.
Thomas
More information about the users
mailing list