[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash -c 'sleep 5 &' vs. ssh user@host 'sleep 5 &'
From: |
Robert Elz |
Subject: |
Re: bash -c 'sleep 5 &' vs. ssh user@host 'sleep 5 &' |
Date: |
Tue, 22 Sep 2020 16:07:07 +0700 |
Date: Tue, 22 Sep 2020 16:47:39 +0800
From: Clark Wang <dearvoid@gmail.com>
Message-ID:
<CADv8-oh6+uwCsvYZyAYKaG+UZ0Gsu_sMCevkwBShbXKTOMxvPQ@mail.gmail.com>
| Ah right. I misunderstood something else. When I run
|
| $ ssh 127.0.0.1 '{ sleep 120 | cat; } & exit'
Yes, in that case the shell running the command list (the {} thing)
typically hangs around to wait for the pipe to finish. There might
be a bash shopt that can alter that. The "exit" at the end accomplishes
nothing (unless you give it an arg to set a non-default exit code).
| Then, how should we explain that
|
| $ ssh -t 127.0.0.1 'sleep 120 &'
|
| would complete immediately?
With -t, there's no pty, when the shell exits, everything ends up
closed - but the mechanism for this escapes me (what bash &/or sshd
sees differently). You'd do better to ask on an ssh related list
I expect.
kre