On Thu, 12 Dec 2013, Fernando C.V. wrote:
On Wed, Dec 11, 2013 at 10:36 PM, Rob <robpill...@gmail.com> wrote:
[local-machine %] ssh user@host & && xmessage connected
[ssh-machine %] ...

`xmessage connected' will be executed even though ssh hasn't exit(0)'d
yet.

bash: syntax error near unexpected token `&&'

You probably meant this:

$  { ssh user@host &; } && xmessage connected

Still, you would always be running "xmessage connected" even in the
case of "ssh user@host" failing, which is not what he wants.

Sorry yeah, I didn't clarify enough - meant to say that it wasn't
actually a valid shell script, I was just saying what it would be sort
of like.

But obviously it can't be done in shell, even with your {} / () subshell
stuff, since we can't tell if ssh has connected until it exits (without
a decent bit of hackery anyway).


Rob

Reply via email to