Usage: ksh [ options ] [arg ...]
Help: ksh [ --help | --man ] 2>&1
OPTIONS
-c Read and execute a script from the first arg instead of a file. The second arg,
if present, becomes that script's command name ($0). Any third and further args
become positional parameters starting at $1.
-s Read and execute a script from standard input instead of a file. The command name
($0) cannot be set. Any args become the positional parameters starting at $1.
This option is forced on if no arg is given and is ignored if -c is also
specified.
-i Specifies that the shell is interactive.
-l Invoke the shell as a login shell; /etc/profile and $HOME/.profile, if they
exist, are read before the first command.
-r Invoke the shell in a restricted mode. A restricted shell does not permit any of
the following:
- Changing the working directory.
- Setting values or attributes of the variables SHELL, ENV, FPATH, or PATH.
- Executing any command whose name as a / in it.
- Redirecting output of a command with >, >|, <>, or >>.
- Adding or deleting built-in commands or libraries with builtin.
- Executing command -p ... .
-D Do not execute the script, but output the set of double quoted strings preceded
by a $. These strings are needed for localization of the script to different
locales.
-E Reads the file ${ENV-$HOME/.kshrc}, if it exists, as a profile. On by default for
interactive shells; use +E to disable.
-a All variables that are assigned a value while this option is on are automatically
exported, unless they have a dot in their name.
-b The shell writes a message to standard error as soon it detects that a background
job completes rather than waiting until the next prompt.
-e A simple command that has an non-zero exit status will cause the shell to exit
unless the simple command is:
+ contained in an && or || list.
+ the command immediately following if, while, or until.
+ contained in the pipeline following !.
-f Pathname expansion is disabled.
-h Obsolete; no effect.
-k All arguments of the form name=value are removed and placed in the variable
assignment list for the command. Ordinarily, variable assignments must precede
command arguments.
-m When enabled, the shell runs background jobs in a separate process group and
displays a line upon completion. This mode is enabled by default for interactive
shells.
-n The shell reads commands and checks for syntax errors, but does not execute the
command. Usually specified on command invocation.
-o[option] A -o with no option will write the list of options and their current settings to
standard output. A +o with no option writes a command that the shell can run to
restore the current options state. -o option or --option turns an option on,
whereas +o option, -o nooption or --nooption turns it off. This can be repeated
to enable/disable multiple options. The option name is case-sensitive but
insensitive to - and _, and may be abbreviated to a non-arbitrary string. It must
resolve to one of the following:
allexport
Equivalent to -a.
backslashctrl
The backslash character \ escapes the next control character in the emacs
built-in editor and the next erase or kill character in the vi built-in
editor. On by default.
bgnice
Runs background jobs at lower priorities.
braceexpand
Equivalent to -B.
clobber
Opposite of -C.
emacs Enables/disables emacs editing mode.
errexit
Equivalent to -e.
exec Opposite of -n.
functrace
Function scopes and subshells inherit the parent environment's DEBUG trap
action. Function scopes inherit the -x option's state.
glob Opposite of -f.
globcasedetect
Pathname expansion and file name completion automatically become
case-insensitive on file systems where the difference between upper- and
lowercase is ignored for file names. Each slash-separated path name
component pattern p is treated as ~(i:p) if its parent directory exists
on a case-insensitive file system.
globstar
Equivalent to -G.
gmacs Enables/disables gmacs editing mode. gmacs editing mode is the same as
emacs editing mode except for the handling of ^T.
histexpand
Equivalent to -H.
histreedit
If a history expansion (see -H) fails, the command line is reloaded into
the next prompt's edit buffer, allowing corrections.
histverify
The results of a history expansion (see -H) are not immediately executed.
Instead, the expanded line is loaded into the next prompt's edit buffer,
allowing further changes.
ignoreeof
Prevents an interactive shell from exiting on reading an end-of-file.
keyword
Equivalent to -k.
letoctal
The let builtin recognizes octal constants with leading 0.
markdirs
A trailing / is appended to directories resulting from pathname
expansion.
monitor
Equivalent to -m.
multiline
Use multiple lines when editing lines that are longer than the window
width. Has no effect on systems with neither terminfo nor termcap support
for the running terminal.
log Obsolete; no effect.
notify
Equivalent to -b.
pipefail
A pipeline will not complete until all components of the pipeline have
completed, and the exit status of the pipeline will be the value of the
last command to exit with non-zero exit status, or will be zero if all
commands return zero exit status.
posix Enable full POSIX standard compliance mode.
privileged
Equivalent to -p.
showme
Simple commands preceded by a ; will be traced as if -x were enabled but
not executed.
trackall
Equivalent to -h.
unset Opposite of -u.
verbose
Equivalent to -v.
vi Enables/disables vi editing mode.
viraw Obsolete; no effect.
xtrace
Equivalent to -x.
The option value may be omitted.
--posix Enable the posix option. When given at invocation time, disables importing
variable type attributes from the environment.
-p Privileged mode. Disabling -p sets the effective user ID to the real user ID, and
the effective group ID to the real group ID. Enabling -p restores the effective
user and group IDs to their values when the shell was invoked. The -p option is
on whenever the real and effective user ID is not equal or the real and effective
group ID is not equal. User profiles are not processed when -p is enabled.
-r restricted. Enables restricted shell. This option cannot be unset once enabled.
-t Obsolete. The shell reads one command and then exits.
-u If enabled, the shell displays an error message when it tries to expand a
variable that is unset.
-v Verbose. The shell displays its input onto standard error as it reads it.
-x Execution trace. The shell will display each command after all expansion and
before execution preceded by the expanded value of the PS4 parameter.
-B Enable {...} group expansion. On by default.
-C Prevents existing regular files from being overwritten using the > redirection
operator. The >| redirection overrides this noclobber option.
-G Causes ** by itself to also match all subdirectories during pathname expansion.
-H Enable !-style history expansion similar to csh.
Options (45)
| Option | Description | Source |
|---|---|---|
-c file | Read and execute a script from the first arg instead of a file. | help + man |
-s file | Read and execute a script from standard input instead of a file. | help + man |
-i | Declares vname to be represented internally as integer. | help + man |
-l | Used with -i, -E or -F, to indicate long integer, or long float. | help + man |
-r file | True if file exists and is readable by current process. | help + man |
-D | A list of all double quoted strings that are preceded by a $ will be printed on standard output and the shell will exit. | help + man |
-E | Reads the file ${ENV-$HOME/.kshrc}, if it exists, as a profile. | help + man |
-a file | All variables that are assigned a value while this option is on are automatically exported, unless they have a dot in their name. | help + man |
-b file | The shell writes a message to standard error as soon it detects that a background job completes rather than waiting until the next prompt. | help + man |
-e file | A simple command that has an non-zero exit status will cause the shell to exit unless the simple command is: + contained in an && or || list. | help + man |
-f file | True if file exists and is an ordinary file. | help + man |
-h file | True if file exists and is a symbolic link. | help + man |
-k file | All arguments of the form name=value are removed and placed in the variable assignment list for the command. | help + man |
-m | When enabled, the shell runs background jobs in a separate process group and displays a line upon completion. | help + man |
-n string | The shell reads commands and checks for syntax errors, but does not execute the command. | help + man |
-o option | A -o with no option will write the list of options and their current settings to standard output. | help + man |
--posix | Enable the posix option. | help |
-p file | True if file exists and is a fifo special file or a pipe. | help + man |
-t fildes | True if file descriptor number fildes is open and associated with a terminal device. | help + man |
-u file | If enabled, the shell displays an error message when it tries to expand a variable that is unset. | help + man |
-v name | True if variable name is a valid variable name and is set. | help + man |
-x file | True if file exists and is executable by current process. | help + man |
-B | Enable {...} group expansion. | help + man |
-C | Prevents existing regular files from being overwritten using the > redirection operator. | help + man |
-G file | True if file exists and its group matches the effective group ID of this process. | help + man |
-H | Enable !-style history expansion similar to csh(1). | help + man |
-d file | True if file exists and is a directory. (in the manual page but not in --help) | man |
-g file | True if file exists and it has its setgid bit set. (in the manual page but not in --help) | man |
-w file | True if file exists and is writable by current process. (in the manual page but not in --help) | man |
-z string | True if length of string is zero. (in the manual page but not in --help) | man |
-L file | True if file exists and is a symbolic link. (in the manual page but not in --help) | man |
-N file | True if file exists and the modification time is greater than the last access time. (in the manual page but not in --help) | man |
-O file | True if file exists and is owned by the effective user ID of this process. (in the manual page but not in --help) | man |
-R name | True if variable name is a name reference. (in the manual page but not in --help) | man |
-S file | True if file exists and is a socket. (in the manual page but not in --help) | man |
-y | Equivalent to 0-y. (in the manual page but not in --help) | man |
-A | Causes the variable vname to be unset and each field that is read to be stored in successive elements of the indexed array vname. (in the manual page but not in --help) | man |
-F | Declares vname to be a double precision floating point number. (in the manual page but not in --help) | man |
-M | Use the character mapping mapping defined by wctrans(3). (in the manual page but not in --help) | man |
-T | If followed by tname, it creates a type named by tname using the compound assignment assign_list to tname. (in the manual page but not in --help) | man |
-X | Declares vname to be a double precision floating point number and expands using the %a format of ISO-C99. (in the manual page but not in --help) | man |
-Z | Right justify and fill with leading zeros if the first non-blank character is a digit and the -L option has not been set. (in the manual page but not in --help) | man |
-P | The max number of pseudo-terminals created by the current user. (in the manual page but not in --help) | man |
-q | The message queue size in K-bytes. (in the manual page but not in --help) | man |
-V | The number of open vnode monitors. (in the manual page but not in --help) | man |