about summary refs log tree commit diff
path: root/Doc
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-07-13 10:09:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-07-13 10:09:06 +0000
commiteea6647c658b56cd9fb99544e4c96b3628d0cd79 (patch)
tree0f14eae7f41cdf8a2bdae3bcbac87f7397092d2e /Doc
parenta1374319dcdd81c66aae6bc8cc0adc0889943cd1 (diff)
downloadzsh-eea6647c658b56cd9fb99544e4c96b3628d0cd79.tar.gz
zsh-eea6647c658b56cd9fb99544e4c96b3628d0cd79.tar.xz
zsh-eea6647c658b56cd9fb99544e4c96b3628d0cd79.zip
23671: command not found handler
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Zsh/exec.yo12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/Zsh/exec.yo b/Doc/Zsh/exec.yo
index 0d53b14b8..30e4a61a2 100644
--- a/Doc/Zsh/exec.yo
+++ b/Doc/Zsh/exec.yo
@@ -5,6 +5,8 @@ sect(Command Execution)
 )\
 cindex(command execution)
 cindex(execution, of commands)
+cindex(command not found, handling of)
+findex(command_not_found_handler)
 If a command name contains no slashes, the shell attempts to locate
 it.  If there exists a shell function by that name, the function
 is invoked as described in noderef(Functions).  If there exists
@@ -23,3 +25,13 @@ is a file beginning with `tt(#!)', the remainder of the first line
 specifies an interpreter for the program.  The shell will
 execute the specified interpreter on operating systems that do
 not handle this executable format in the kernel.
+
+If no external command is found but a function tt(command_not_found_handler)
+exists the shell executes this function with all
+command line arguments.  The function should return status zero if it
+successfully handled the command, or non-zero status if it failed.
+In the latter case the standard handling is applied: `command not
+found' is printed to standard error and the shell exits with status 127.
+Note that the handler is executed in a subshell forked to execute
+an external command, hence changes to directories, shell parameters,
+etc. have no effect on the main shell.