[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
&& operator prevents backgrounding over ssh
From: |
Hinrik Örn Sigurðsson |
Subject: |
&& operator prevents backgrounding over ssh |
Date: |
Thu, 26 Sep 2013 06:27:10 +0000 |
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.
A workaround in this case is to use "|| exit 1;" instead of "&&".
- && operator prevents backgrounding over ssh,
Hinrik Örn Sigurðsson <=