[issue564] support command-not-found within grml's zsh on request?

Michael Prokop bts at bts.grml.org
Mon Oct 27 22:38:58 CET 2008


Michael Prokop <mika at grml.org> added the comment:

* Frank Terbeck <bts at bts.grml.org> [20081027 22:32]:

> I actually meant. How does command-not-found work? :-)

Ah, sorry. :)

,---- [ /etc/zsh_command_not_found ]
| # (c) Zygmunt Krynicki 2007,
| # Licensed under GPL, see COPYING for the whole text
| #
| # This script will look-up command in the database and suggest
| # installation of packages available from the repository
|
| function preexec() {
|         command="${1%% *}"
| }
|
| function precmd() {
|         (($?)) && [ -n "$command" ] && [ -x /usr/share/command-not-found/command-not-found ] && {
|                 whence -- "$command" >& /dev/null ||
|                         /usr/share/command-not-found/command-not-found -- "$command"
|                 unset command
|         }
| }
`----

So when sourcing this file and invoking a command which isn't
present it displays which Debian package might provide the command.

Demonstration (manually invoking
/usr/share/command-not-found/command-not-found though here):

% /usr/share/command-not-found/command-not-found nautilus
The program 'nautilus' is currently not installed.  To run 'nautilus' please ask your administrator to install the package 'nautilus
'

regards,
-mika-

----------
assignedto: ft
messages: 1627, 1628, 1629, 1630, 1631
nosy: ft, mika
priority: feature
status: chatting
title: support command-not-found within grml's zsh on request?
topic: configs, zsh

_____________________________________
GRML issue tracker <bts at bts.grml.org>
<http://bts.grml.org/grml/issue564>
_____________________________________


More information about the Bugs-changes mailing list