Dans la configuration par défaut de bash dans ubuntu , lorsque vous tapez le nom d'un logiciel qui n'est pas installé, bash explique comment l'installer si l'exécutable existe ou comment installer un exécutable avec un nom très proche s'il ne l'est pas exister. Par exemple avec emacs (qui n'est pas installé sur ma machine):
$ emacx No command 'emacx' found, did you mean: Command 'emacs' from package 'emacs23-lucid' (universe) Command 'emacs' from package 'e3' (universe) Command 'emacs' from package 'emacs23-nox' (main) Command 'emacs' from package 'emacs24' (main) Command 'emacs' from package 'emacs24-nox' (main) Command 'emacs' from package 'emacs23' (main) Command 'emacs' from package 'jove' (universe) Command 'emacs' from package 'emacs24-lucid' (universe) emacx: command not found $ emacs The program 'emacs' can be found in the following packages: * emacs23 * emacs23-nox * emacs24 * emacs24-nox * e3 * emacs23-lucid * emacs24-lucid * jove Try: sudo apt-get install <selected package>
Avec ma configuration actuelle de zsh j'obtiens:
$ emacx zsh: command not found: emacx $ emacs zsh: command not found: emacs
Il y a aussi une différence de comportement en cas d'erreur dans le nom d'un logiciel installé. Disons que je veux lancer gedit au lieu de kedit . Avec bash , j'obtiens:
$ kedit No command 'kedit' found, did you mean: Command 'xedit' from package 'x11-apps' (main) Command 'edit' from package 'mime-support' (main) Command 'nedit' from package 'nedit' (universe) Command 'gedit' from package 'gedit' (main) Command 'jedit' from package 'jedit' (universe) Command 'medit' from package 'medit' (universe) Command 'ledit' from package 'ledit' (main) kedit: command not found
Alors qu'avec zsh j'obtiens:
$ kedit zsh: correct 'kedit' to 'edit' [nyae]?
Donc, mes questions sont les suivantes:
La configuration par défaut de zsh pour Debian (et probablement Ubuntu) n'inclut pas la prise en charge du packageage command-not-found
par défaut.
Pour avoir les mêmes fonctionnalités, il vous suffit de /etc/zsh_command_not_found
dans votre ~/.zshrc
par défaut via:
[ -f /etc/zsh_command_not_found ] && . /etc/zsh_command_not_found
Cela devrait charger et activer la fonctionnalité de command-not-found
dans zsh
.