My Bash Terminal is stuck after a bad command.
Even opening new shell instances (cmd T) starts the same hangup ending with a [Process completed]
message.
It's rendering bash terminal unusable (cannot type or run any other process). How can I kill the hangup process?
Note: ^C
, ^D
, ^Z
do not work.
Best Answer
This is on macOS, right?
As it's difficult to edit the file from a terminal (owing to the fact that the shell will immediately exit), open the file you previously modified (probably
~/.bashrc
,~/.bash_profile
, or~/.profile
), from the Finder, in a text editor, and correct the error.You should be able to toggle the listing of hidden files in any "Open File" dialog box, or in the Finder itself, by pressing ⌘ CMD+⇧ SHIFT+..
Another option is simply to rename the file that you think is causing the issue. Again, do this from the Finder.
Speculating on the cause:
You may have inadvertently executed
exit
, possibly unconditionally, or through following some logic branching. Or you may have usedset -e
orset -o errexit
and then had a utility exit with a non-zero exit status (i.e. failing).