Re: ssh in bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 5, 2005 11:08 AM, rado <rado@xxxxxxxxxxxxxxx> 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?

I think all you need to do is put the command you want to run at the
end of the ssh line. That is, rather than

ssh host

and then putting the command on a separate line of the script, you use
something like

ssh host command

(schematically, at least--I don't know what other options you're
using). See man ssh for details.
 
> 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?

I'm not sure what you're asking there, but I'm a terrible scripter
anyway so I bet someone else will give better help :-).


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux