I also added a check to both shell snippets (i.e., for zsh and for bash)
that prevents defining the handler function if the shell is run
interactively. Ideally, all users would set up their shell rc files in a
way that does not source the snippets for interactive shells, but users
are not perfect …. I can imagine rare cases where command-not-found is
used for debugging, and where a user might want to enable it even for
non-interactive shells. To ease this, $PS1 is checked, and not $-. The
outer if condition now is for both shells: [[ -n "${PS1-}" && -x
/usr/lib/command-not-found ]]I also replaced all tabs with four spaces each in the zsh snippet in order to let the file fit on an 80 characters wide terminal w/o line wrapping. There is still one issue that could be fixed in these files: LP:#559060. Don't expect a patch from me for this one, although I might send one, if I stumble over a clean solution. http://stateful.de/~carsten/tmp/150730jFFWrFL4qo4/bash_command_not_found http://stateful.de/~carsten/tmp/150730jFFWrFL4qo4/zsh_command_not_found * bash_command_not_found: - Print an error message if a command is not found, and the package has been removed but not purged. (LP: #1479805) - Do not define the handler function if the package has been removed. - Do not define the handler function if the shell is interactive. * zsh_command_not_found: - Do not define the handler function if the shell is not interactive. - Reindent file in order to fit on an 80 characters wide terminal without line wrapping. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1479805 Title: /etc/bash_command_not_found is utterly broken To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/command-not-found/+bug/1479805/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
