3

This seems to be a bug, but i'm not sure which package to report it on. Try this:

  • Open gnome-terminal
  • shift-ctrl-t (open a new tab)
  • type: foo foo &
  • The tab is closed

Correct behavior would be Command not found.

This happens every time on gnome-terminal. On xterm (without tabs of course) it works randomly - maybe 2 of 3 times tried.

2
  • Which Ubuntu and kernel versions are you using? It works as it should for me. Dec 31, 2013 at 14:10
  • I just tested this on another computer and it works as expected. I don't have a custom .bash_profile, and Ubuntu version is Saucy with updates. Looks like this issue is not easily reproducible.
    – cos
    Jan 1, 2014 at 18:51

2 Answers 2

6

Let me guess, there is set -e (or it’s long form set -o errexit) option in your .bashrc (.bash_profile).

-e

Exit immediately if a pipeline (which may consist of a single simple command), a subshell command enclosed in parentheses, or one of the commands executed as part of a command list enclosed by braces (see SHELL GRAMMAR above) exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test following the if or elif reserved words, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command’s return value is being inverted with !. A trap on ERR, if set, is executed before the shell exits. This option applies to the shell environment and each subshell environment separately (see COMMAND EXECUTION ENVIRONMENT above), and may cause subshells to exit before executing all the commands in the subshell.

— bash(1)

This option is very useful for some scripts – it allows to avoid numerous || exit 1, e. g. instead of

cd /var/ || exit 1
tar -cvf myarchive.tar "$SOMEDIR" || exit 1
rm -r "$SOMEDIR"

you can write

set -e
cd /var/
tar -cvf myarchive.tar "$SOMEDIR"
rm -r "$SOMEDIR"

But of course there is no any reason to set it for interactive bash session.

5
  • 1
    This is probably the right answer, but please explain in more detail.
    – chaskes
    Dec 31, 2013 at 16:02
  • See linuxcommand.org/lc3_man_pages/seth.html for more information. -e Exit immediately if a command exits with a non-zero status. Dec 31, 2013 at 16:04
  • 2
    @JohnWHSmith Thanks for the link. :) I'm suggesting the answer would be improved by providing more detail in the answer for the OP.
    – chaskes
    Dec 31, 2013 at 16:14
  • @chaskes Well. I don’t quite realize which details I may provide. Citation from man and example of proper usage perhaps (added)? Dec 31, 2013 at 21:38
  • @DmitryAlexandrov Yes, exactly. It's a much better answer now.
    – chaskes
    Jan 1, 2014 at 0:18
2

Check and verify that you don't have some bashrc or profile configuration to change the normal behaviour of this instance.

The best way to verify this is to backup your current bashrc and profile files then replace the active ones with virgin copies of those two files. Log out then log back in and check if you still have this behaviour.

If this cures this flaw, carefully add your custom configuration, and take note to the last change made if the flaw comes back.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .