Why does this command kill my shell?

I could reproduce this issue in an Ubuntu VM but not on an OEL VM. Difference was, on Ubuntu the package command-not-found was installed, and it provides the python script /usr/lib/command-not-found. This script is responsible for exiting the shell.

In /etc/bash.bashrc, there is a function command-not-found_handle , which executes /usr/lib/command-not-found. Hence, the terminal exits when we try to execute such commands. When I commented out the call to /usr/lib/command-not-found, the issue was no longer reproducible.

From my /etc/bash.bashrc:

function command_not_found_handle {
     #check because c-n-f could've been removed in meantime 
     if [ -x /usr/lib/command-not-found ]; then 
          /usr/bin/python /usr/lib/command-not-found -- "$1"
          return $?
     elif [ -x /usr/share/command-not-founf/command-not-found ]; then
          /usr/bin/python /usr/share/command-not-founf/command-not-found -- "$1"
          return $?
     else
          printf "%s:command not found\n" "$1"
          return 127
     fi
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)