When running, for example, a&
in bash, the terminal window closes, where I would expect a new process to start followed by an error message (similar to, for example, grep &
).
What is causing this behavior? Is it intentional?
edit: as requested,
yuvalw@UX410UQK:~$ echo $-
himBH
I also tried opening another bash in bash to get additional output. My input is bash
followed by a&
and a few new lines:
yuvalw@UX410UQK:~$ bash
yuvalw@UX410UQK:~$ a&
[1] 15323
yuvalw@UX410UQK:~$ exit
yuvalw@UX410UQK:~$ a: command not found
yuvalw@UX410UQK:~$
here calling a&
again will close the terminal window.
edit2: more echos
yuvalw@UX410UQK:~$ echo "$BASH_VERSION $SHELLOPTS $BASHOPTS"
4.3.48(1)-release braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:histappend:interactive_comments:progcomp:promptvars:sourcepath
trap:
yuvalw@UX410UQK:~$ trap
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU
type exit:
yuvalw@UX410UQK:~$ type exit
exit is a shell builtin
PROMPT_COMMAND (empty):
yuvalw@UX410UQK:~$ echo $PROMPT_COMMAND
PS1:
yuvalw@\UX410UQK:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
edit 3: Opening a new terminal it doesn't seem like this happens, and I can run a&
just fine, but after cd
ing around for a bit the issue returns. In both cases the command_not_found_handle looks the same.
yuvalw@yuvalw-UX410UQK:~$ type command_not_found_handle
command_not_found_handle is a function
command_not_found_handle ()
{
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1";
return $?;
else
if [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1";
return $?;
else
printf "%s: command not found\n" "$1" 1>&2;
return 127;
fi;
fi
}
[1] 3829
,bash: a: command not found
, then a new prompt.echo $-
?echo "$BASH_VERSION $SHELLOPTS $BASHOPTS"
trap
andtype exit
?type a command_not_found_handle
? That's something I could reproduce withperl -MPOSIX -e '$SIG{TTOU} = "IGNORE"; tcsetpgrp(1,getpgrp) or die$!' &
. That is with something that puts itself in foreground causing the shell to be in background and then fail to read from the terminal, causing it to exit with thatexit
message.