Terminal crashes on error/autocomplete

My terminal (any kind, my default is konsole but same behaviour on any other term or on tty even) crashes on any error. Same behaviour when i try to autocomplete i.e. cd Doc followed by a TAB (using bash).
I did find out that 1) as superuser this is not happening. after a ‘sudo su’, i can use my terminal normally.
2) When i add a “set +e” at the end of my .bashrc the problem is solved too. The output of “echo $-” is: “ehimBHs” (without the set +e ofc, since that solves the issue).
From a practical point of view i can use my terminal again, but i want to understand where that exit bash strategy comes from. I most likely did introduce this bug myself, was running some scripts that weren’t meant to run on my machine but on a remote device. Maybe someone out there has ideas where to look for, to avoid further bugs from that odd behaviour.

It sounds like you may have set the errexit option somewhere, which causes the shell to exit immediately if any command it runs exits with a non-zero status. When you set +e, it disables this option

Check both your .bashrc and .bash_profile files for any lines that set or unset the errexit option (set -e or set +e).

1 Like

Thanks for your reply. In fact i did look for those things already, but after your comment i had a deeper look and found that i was sourcing other scripts, in which the errexit was set.
I didn’t know that this sets the strategy globally.
ISsue solved.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.