Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Are you certain that "sh" on the remote system is bash? Commented Dec 18, 2018 at 19:04
  • 1
    It seems like there was a similar problem earlier, where the shell doesn't fork because there's a simple command. Does the behavior change if you ask it to run sh -c 'sleep 0.1; exit 5'? Commented Dec 18, 2018 at 19:05
  • @JeffSchaller No, I am not certain. On Ubuntu, /bin/sh actually points to /bin/dash. Nevertheless the behaviour does not change if I use absolute paths (/bin/bash and /bin/sh instead of sh). I hope there is no further auto-redirect going on. Commented Dec 18, 2018 at 19:41
  • @JeffSchaller Yes, even ssh host sh -c ':; exit 5' yields the expected return code. This does not help me as in the real world script, there is a lot more going on. I want to examine what forks where and then improve the examples in my question. Commented Dec 18, 2018 at 19:43