Hát a válasz a forráskódban megtalálható (bash 4.2, execute_cmd.c 1431. és 493. sor):
/* If this is a user subshell, set a flag if stdin was redirected.
This is used later to decide whether to redirect fd 0 to
/dev/null for async commands in the subshell. This adds more
sh compatibility, but I'm not sure it's the right thing to do. */
if (user_subshell)
{
stdin_redir = stdin_redirects (command->redirects);
restore_default_signal (0);
}
/* If this is an asynchronous command (command &), we want to
redirect the standard input from /dev/null in the absence of
any specific redirection involving stdin. */
if (should_redir_stdin && stdin_redir == 0)
async_redirect_stdin ();
async_redirect_stdin ()
{
int fd;
fd = open ("/dev/null", O_RDONLY);
if (fd > 0)
{
dup2 (fd, 0);
close (fd);
}
else if (fd < 0)
internal_error (_("cannot redirect standard input from /dev/null: %s"), strerror (errno));
}
Szóval ha egy subshell-ről van szó, az indított parancs a háttérben van futtatva (&)
és át van irányítva az stdin-je a futtató shell-nek, akkor a bash még mielőtt elindítaná az ssh-t beállítja az stdin-t /dev/null-ra.
sh kompatibilitás miatt :]
Ez látszik az strace-ből is.