Date:        Tue, 22 Sep 2020 16:47:39 +0800
    From:        Clark Wang <dearv...@gmail.com>
    Message-ID:  
<cadv8-oh6+uwcsvyzyaykag+uz0gsu_smcevkwbshbxktomx...@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



Reply via email to