I tried to follow other answers on here that I found but I cannot stop my terminal from closing as soon as it opens on Ubuntu 14.04 LTS.

Here are my profile files.


Environment is simply


Thanks for your help.

Seems to only happen after adding my user to the sftp user group. My other account worked fine until I did this.

  • 1
    If you move these files somewhere else, do you have the same problem? If so, they are not the cause of it. If you try with another user, do you have the same problem? If so, the problem is not user-specific. – dadexix86 Jun 18 '16 at 15:42
  • 1
    Did you try moving those files somewhere else? – dadexix86 Jun 18 '16 at 15:45
  • 1
    So, they are not the problem. What else did you change in the terminal from the default? Like profile and such? Install another terminal, like xterm, and try to launch gnome-terminal from there. Does it give any error? Does it work? – dadexix86 Jun 18 '16 at 15:48
  • 1
    Did you modify terminal preference ? I am talking about that popup window where you set color, background, etc. This is frequent problem when users modify the "Run custom command " part – Sergiy Kolodyazhnyy Jun 18 '16 at 15:56
  • 1
    The problem is not in either of those files. Please edit your question and add the contents of ~/.bash_login, ~/bash_aliases, /etc/bash.bashrc, /etc/profile and /etc/environment. If any of these files doesn't exist, ignore it. Also, try creating a new user, can the new user open a terminal? – terdon Jun 18 '16 at 17:51

Your problem is that, by the time you open a terminal, the i flag is no longer set in '$-'. Replace:

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;


# If not running interactively, remember
case $- in
    *i*) IsInteractive=1;;
      *) IsInteractive=0;;
  • Unfortunately I am having the same issue after making these changes and rebooting. – Nick M Jun 18 '16 at 17:08
  • 2
    There's nothing wrong with the case statement. The return just means that the rest of the file is not read, not that the shell will exit. – terdon Jun 18 '16 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.