zsh - The Z shell
Description
zsh is a UNIX command interpreter (shell) that is used as an interactive login shell and as a shell script command processor. It has command-line editing, built-in spelling correction, programmable command completion, shell functions (with autoloading), a history mechanism, and a host of other features.
- -c
- Takes the first argument as a command to execute, rather than reading commands from a script or
standard input. If any further arguments are given, the first one is assigned to
$0, rather than being used as a positional parameter. - -i
- Forces the shell to be interactive. It is still possible to specify a script to be executed.
- -s
- Forces the shell to read commands from the standard input. If the -s flag is not present and an argument is given, the first argument is taken to be the path name of a script to be executed.
If there are any remaining arguments after option processing and the -c or
-s option was not supplied, the first argument is taken as the file name of a
script that contains the shell commands to be executed. If the option PATH_SCRIPT is set and the
file name does not contain a directory path (that is, there is no / in the name),
first the current directory is searched first for the script. Then, the command path that is given
by the variable PATH is searched. If the option is not set or if the file name contains a
/, it is used directly.
After the first one or two arguments have been appropriated, the remaining arguments are assigned to the positional parameters.
For the options that are common to invocation and the set built-in command, see Options.
The long option '--emulate' followed (in a separate word) by an emulation mode may be passed to the shell. The emulation modes are those described for the emulate built-in (see Shell built-in commands). The '--emulate' option must precede any other options (which might otherwise be overridden). However, the following options are accepted, so you can use them to modify the requested emulation mode. Extra steps are taken to ensure a smooth emulation when this option is used compared with the emulate command within the shell. For example, variables that conflict with POSIX usage such as path are not defined within the shell.
zsh -x -o shwordsplit scr runs the script scr,
setting the XTRACE option by the corresponding letter '-x' and the SH_WORD_SPLIT
option by name. Options can be turned _off_ by name by using +o
instead of -o. The -o option can be stacked up with preceding
single-letter options. For example '-xo shwordsplit' or '-xoshwordsplit'
is equivalent to '-x -o shwordsplit'.You can also specify options by name in GNU long option style, '--OPTION-NAME'.
In this situation, '-' characters in the option name are permitted. They are
converted into '_' and thus ignored. For example, 'zsh
--sh-word-split' invokes zsh with the SH_WORD_SPLIT option turned on.
Like other option syntaxes, you can turn off options by replacing the initial '-'
with a '+'. Thus '+-sh-word-split' is equivalent to
'--no-sh-word-split'. Unlike other option syntaxes, GNU-style long options cannot
be stacked with any other options. For example, '-x-shwordsplit' is an error,
rather than being treated like '-x --shwordsplit'.
The special GNU-style option '--version' is handled; it sends to standard output the shell's version information, then exits successfully. '--help' is also handled; it sends to standard output a list of options that can be used when invoking the shell, then exits successfully.
- First, a lone '-' (or '+') as an argument by itself ends option processing.
- Then a special option '--' (or '+-'), which can be specified on its own (which is the standard POSIX usage) or stacked with preceding options (so '-x-' is equivalent to '-x --'). You cannot stack options after '--'(so '-x-f' is an error). However, the GNU-style option form where '--shwordsplit' is permitted and does not end option processing.
Except when the 'sh' or 'ksh' emulation single-letter options are in effect, the option '-b' (or '+b') ends option processing. The '-b' option is like '--', except that more single-letter options can be stacked after the '-b' and will take effect as normal.
The IBM Education home page contains a course catalog, training paths, a list of classes, and several links, including a link to the IBM® Education Assistant. The IBM Education Assistant is a collection of multimedia educational modules that are designed to help you gain a better understanding of IBM products and use them more effectively to meet your business requirements. z/OS 3.1 IBM Education Assistant (Zsh) provides additional information about zsh.

