2013/9/26 Hinrik Örn Sigurðsson <[email protected]>
> The "&&" operator in bash seems to inhibit backgrounding when run over
> ssh. You can try it with the following:
>
> ssh localhost "cd /tmp && nohup sleep 10 >/dev/null 2>&1 &"
>
> The above command will wait for sleep(1) to finish before returning.
> If it is run without ssh, it returns immediately. Furthermore, other
> shells such as dash and zsh will return immediately regardless of
> whether ssh is used.
>
Probably because it's equivalent to
{ cd /tmp && nohup sleep 10 >/dev/null 2>&1; } &
so the backgrounded process still have stdout and stderr connected to ssh.
This should do what you want:
cd /tmp && { nohup sleep 10 >/dev/null 2>&2 & }
--
Geir Hauge