The observed condition is input getting split between the shell and the background process. I couldn’t figure out what the general case is to trigger this, but I can observe it when an ssh process with an open unix socket is placed in the background.
Below is my recipe to reproduce. First step is to create an SSH “master” connection, which creates a socket and runs in the background. This can be done in a separate shell. The step that triggers the issue is to start an ssh process that connects to that socket, and then put that in the background. # set up control master mkdir -p ~/.ssh/sockets chmod 0600 ~/.ssh/sockets ssh -Nf -o 'ControlMaster=auto' \ -o 'ControlPath=~/.ssh/sockets/%r@%h:%p' \ -o 'ControlPersist=600' \ localhost # start an ssh session that uses the above socket and put it in the background ssh -o 'ControlMaster=auto' \ -o 'ControlPath=~/.ssh/sockets/%r@%h:%p' \ localhost 'read -d0; echo; echo "read: $REPLY"' & # type in 1234567890000 Produces output like: bash-4.4$ ssh -o 'ControlMaster=auto' -o 'ControlPath=~/.ssh/sockets/%r@%h:%p' localhost 'read -d0; echo; echo $REPLY' & [1] 26868*bash-4.4$ 1346800 read: 2579* ^C [1]+ Done ssh -o 'ControlMaster=auto' -o 'ControlPath=~/.ssh/sockets/%r@%h:%p' localhost 'read -d0; echo; echo $REPLY' bash-4.4$