-c string mksh will execute the command(s) contained in string.
|
-i Interactive shell. A shell is “interactive” if this option is used or if both standard input
and standard error are attached to a tty(4). An interactive shell has job control enabled,
ignores the SIGINT, SIGQUIT, and SIGTERM signals, and prints prompts before reading input (see
the PS1 and PS2 parameters). It also processes the ENV parameter or the mkshrc file (see
below). For non-interactive shells, the trackall option is on by default (see the set command
below).
|
-l Login shell. If the basename the shell is called with (i.e. argv[0]) starts with ‘-’ or if this
option is used, the shell is assumed to be a login shell; see Startup files below.
|
-p Privileged shell. A shell is “privileged” if this option is used or if the real user ID or
group ID does not match the effective user ID or group ID (see getuid(2) and getgid(2)).
Clearing the privileged option causes the shell to set its effective user ID (group ID) to its
real user ID (group ID). For further implications, see Startup files.
|
-r Restricted shell. A shell is “restricted” if this option is used. The following restrictions
come into effect after the shell processes any profile and ENV files:
The cd (and chdir) command is disabled.
· The SHELL, ENV, and PATH parameters cannot be changed.
· Command names can't be specified with absolute or relative paths.
· The -p option of the built-in command command can't be used.
· Redirections that create files can't be used (i.e. ‘>’, ‘>|’, ‘>>’, ‘<>’).
|
-s The shell reads commands from standard input; all non-option arguments are positional
parameters.
|
-T tty Spawn mksh on the tty(4) device given. Superuser only. If tty is a dash, detach from
controlling terminal (daemonise) instead.
|
-A Store the result into the parameter p (or REPLY) as array of words.
|
-a Store the result without word splitting into the parameter p (or REPLY) as array of
characters (wide characters if the utf8-mode option is enacted, octets otherwise).
|
-d x Use the first byte of x, NUL if empty, instead of the ASCII newline character as input line
delimiter.
|
-N z Instead of reading till end-of-line, read exactly z bytes; less if EOF or a timeout occurs.
|
-n z Instead of reading till end-of-line, read up to z bytes but return as soon as any bytes are
read, e.g. from a slow terminal device, or if EOF or a timeout occurs.
|
-p Read from the currently active co-process, see Co-processes above for details on this.
|
-u[n] Read from the file descriptor n (defaults to 0, i.e. standard input). The argument must
immediately follow the option character.
|
-t n Interrupt reading after n seconds (specified as positive decimal value with an optional
fractional part).
|
-r Normally, the ASCII backslash character escapes the special meaning of the following
character and is stripped from the input; read does not stop when encountering a backslash-
newline sequence and does not store that newline in the result. This option enables raw
mode, in which backslashes are not processed.
|
-s The input line is saved to the history.
|
-A name
Sets the elements of the array parameter name to arg ... If -A is used, the array is reset
(i.e. emptied) first; if +A is used, the first N elements are set (where N is the number of
arguments); the rest are left untouched.
An alternative syntax for the command set -A foo -- a b c which is compatible to GNU bash and
also supported by AT&T UNIX ksh93 is: foo=(a b c); foo+=(d e)
Another AT&T UNIX ksh93 and GNU bash extension allows specifying the indices used for arg ...
(from the above example, a b c) like this: set -A foo -- [0]=a [1]=b [2]=c or foo=([0]=a [1]=b
[2]=c) which can also be written foo=([0]=a b c) because indices are incremented automatically.
|
-a | -o allexport
All new parameters are created with the export attribute.
|
-b | -o notify
Print job notification messages asynchronously, instead of just before the prompt. Only used
if job control is enabled (-m).
|
-C | -o noclobber
Prevent > redirection from overwriting existing files. Instead, >| must be used to force an
overwrite.
|
-e | -o errexit
Exit (after executing the ERR trap) as soon as an error occurs or a command fails (i.e. exits
with a non-zero status). This does not apply to commands whose exit status is explicitly
tested by a shell construct such as if, until, while, &&, ||, or ! statements.
|
-f | -o noglob
Do not expand file name patterns.
|
-h | -o trackall
Create tracked aliases for all executed commands (see Aliases above). Enabled by default for
non-interactive shells.
|
-i | -o interactive
The shell is an interactive shell. This option can only be used when the shell is invoked.
See above for a description of what this means.
|
-k | -o keyword
Parameter assignments are recognised anywhere in a command.
|
-l | -o login
The shell is a login shell. This option can only be used when the shell is invoked. See above
for a description of what this means.
|
-m | -o monitor
Enable job control (default for interactive shells).
|
-n | -o noexec
Do not execute any commands. Useful for checking the syntax of scripts (ignored if
interactive).
|
-p | -o privileged
The shell is a privileged shell. It is set automatically if, when the shell starts, the real
UID or GID does not match the effective UID (EUID) or GID (EGID), respectively. See above for
a description of what this means.
|
-r | -o restricted
The shell is a restricted shell. This option can only be used when the shell is invoked. See
above for a description of what this means.
|
-s | -o stdin
If used when the shell is invoked, commands are read from standard input. Set automatically if
the shell is invoked with no arguments.
When -s is used with the set command it causes the specified arguments to be sorted before
assigning them to the positional parameters (or to array name, if -A is used).
|
-U | -o utf8-mode
Enable UTF-8 support in the Emacs editing mode and internal string handling functions. This
flag is disabled by default, but can be enabled by setting it on the shell command line; is
enabled automatically for interactive shells if requested at compile time, your system supports
setlocale(LC_CTYPE, "") and optionally nl_langinfo(CODESET), or the LC_ALL, LC_CTYPE, or LANG
environment variables, and at least one of these returns something that matches “UTF-8” or
“utf8” case-insensitively; for direct builtin calls depending on the aforementioned environment
variables; or for stdin or scripts, if the input begins with a UTF-8 Byte Order Mark.
|
-u | -o nounset
Referencing of an unset parameter, other than “$@” or “$*”, is treated as an error, unless one
of the ‘-’, ‘+’, or ‘=’ modifiers is used.
|
-v | -o verbose
Write shell input to standard error as it is read.
|
-X | -o markdirs
Mark directories with a trailing ‘/’ during file name generation.
|
-x | -o xtrace
Print commands and parameter assignments when they are executed, preceded by the value of PS4.
|
-o arc4random
Deprecated, will be removed in mksh R41. Do not use, emits a warning to stderr.
|
-o bgnice
Background jobs are run with lower priority.
|
-o braceexpand
Enable brace expansion (a.k.a. alternation). This is enabled by default. If disabled, tilde
expansion after an equals sign is disabled as a side effect.
|
-o emacs
Enable BRL emacs-like command-line editing (interactive shells only); see Emacs editing mode.
|
-o gmacs
Enable gmacs-like command-line editing (interactive shells only). Currently identical to emacs
editing except that transpose-chars (^T) acts slightly differently.
|
-o ignoreeof
The shell will not (easily) exit when end-of-file is read; exit must be used. To avoid
infinite loops, the shell will exit if EOF is read 13 times in a row.
|
-o nohup
Do not kill running jobs with a SIGHUP signal when a login shell exits. Currently set by
default, but this may change in the future to be compatible with AT&T UNIX ksh, which doesn't
have this option, but does send the SIGHUP signal.
|
-o nolog
No effect. In the original Korn shell, this prevents function definitions from being stored in
the history file.
|
-o physical
Causes the cd and pwd commands to use “physical” (i.e. the filesystem's) ‘..’ directories
instead of “logical” directories (i.e. the shell handles ‘..’, which allows the user to be
oblivious of symbolic links to directories). Clear by default. Note that setting this option
does not affect the current value of the PWD parameter; only the cd command changes PWD. See
the cd and pwd commands above for more details.
|
-o posix
Enable a somewhat more POSIXish mode. As a side effect, setting this flag turns off
braceexpand mode, which can be turned back on manually, and sh mode.
|
-o sh
Enable /bin/sh (kludge) mode. Automatically enabled if the basename of the shell invocation
begins with “sh” and this autodetection feature is compiled in (not in MirBSD). As a side
effect, setting this flag turns off braceexpand mode, which can be turned back on manually, and
posix mode.
|
-o vi
Enable vi(1)-like command-line editing (interactive shells only).
|
-o vi-esccomplete
In vi command-line editing, do command and file name completion when escape (^[) is entered in
command mode.
|
-o vi-tabcomplete
In vi command-line editing, do command and file name completion when tab (^I) is entered in
insert mode. This is the default.
|
-o viraw
No effect. In the original Korn shell, unless viraw was set, the vi command-line mode would
let the tty(4) driver do the work until ESC (^[) was entered. mksh is always in viraw mode.
|
-a file file exists.
|
-b file file is a block special device.
|
-c file file is a character special device.
|
-d file file is a directory.
|
-e file file exists.
|
-f file file is a regular file.
|
-G file file's group is the shell's effective group ID.
|
-g file file's mode has the setgid bit set.
|
-H file file is a context dependent directory (only useful on HP-UX).
|
-h file file is a symbolic link.
|
-k file file's mode has the sticky(8) bit set.
|
-L file file is a symbolic link.
|
-O file file's owner is the shell's effective user ID.
|
-o option Shell option is set (see the set command above for a list of options). As a non-
standard extension, if the option starts with a ‘!’, the test is negated; the
test always fails if option doesn't exist (so [ -o foo -o -o !foo ] returns true
if and only if option foo exists). The same can be achieved with [ -o ?foo ]
like in AT&T UNIX ksh93. option can also be the short flag led by either ‘-’ or
‘+’ (no logical negation), for example ‘-x’ or ‘+x’ instead of ‘xtrace’.
|
-p file file is a named pipe (FIFO).
|
-r file file exists and is readable.
|
-S file file is a unix(4)-domain socket.
|
-s file file is not empty.
|
-t fd File descriptor fd is a tty(4) device.
|
-u file file's mode has the setuid bit set.
|
-w file file exists and is writable.
|
-x file file exists and is executable.
file1 -nt file2 file1 is newer than file2 or file1 exists and file2 does not.
file1 -ot file2 file1 is older than file2 or file2 exists and file1 does not.
file1 -ef file2 file1 is the same file as file2.
string string has non-zero length.
|
-n string string is not empty.
|
-z string string is empty.
|
string = string Strings are equal.
|
-a Indexed array attribute.
|
-f Function mode. Display or set functions and their attributes, instead of parameters.
|
-i[n] Integer attribute. n specifies the base to use when displaying the integer (if not
specified, the base given in the first assignment is used). Parameters with this attribute
may be assigned values containing arithmetic expressions.
|
-L[n] Left justify attribute. n specifies the field width. If n is not specified, the current
width of a parameter (or the width of its first assigned value) is used. Leading whitespace
(and zeros, if used with the -Z option) is stripped. If necessary, values are either
truncated or space padded to fit the field width.
|
-l Lower case attribute. All upper case characters in values are converted to lower case. (In
the original Korn shell, this parameter meant “long integer” when used with the -i option.)
|
-n Create a bound variable (name reference): any access to the variable name will access the
variable value in the current scope (this is different from AT&T UNIX ksh93!) instead.
Also different from AT&T UNIX ksh93 is that value is lazily evaluated at the time name is
accessed. This can be used by functions to access variables whose names are passed as
parametres, instead of using eval.
|
-p Print complete typeset commands that can be used to re-create the attributes and values of
parameters.
|
-R[n] Right justify attribute. n specifies the field width. If n is not specified, the current
width of a parameter (or the width of its first assigned value) is used. Trailing
whitespace is stripped. If necessary, values are either stripped of leading characters or
space padded to make them fit the field width.
|
-r Read-only attribute. Parameters with this attribute may not be assigned to or unset. Once
this attribute is set, it cannot be turned off.
|
-t Tag attribute. Has no meaning to the shell; provided for application use.
For functions, -t is the trace attribute. When functions with the trace attribute are
executed, the xtrace (-x) shell option is temporarily turned on.
|
-U Unsigned integer attribute. Integers are printed as unsigned values (combine with the -i
option). This option is not in the original Korn shell.
|
-u Upper case attribute. All lower case characters in values are converted to upper case. (In
the original Korn shell, this parameter meant “unsigned integer” when used with the -i
option which meant upper case letters would never be used for bases greater than 10. See
the -U option.)
For functions, -u is the undefined attribute. See Functions above for the implications of
this.
|
-x Export attribute. Parameters (or functions) are placed in the environment of any executed
commands. Exported functions are not yet implemented.
|
-Z[n] Zero fill attribute. If not combined with -L, this is the same as -R, except zero padding
is used instead of space padding. For integers, the number instead of the base is padded.
If any of the -i, -L, -l, -R, -U, -u, or -Z options are changed, all others from this set are
cleared, unless they are also given on the same command line.
ulimit [-aBCcdefHiLlMmnOPpqrSsTtVvw] [value]
Display or set process limits. If no options are used, the file size limit (-f) is assumed. value,
if specified, may be either an arithmetic expression or the word “unlimited”. The limits affect the
shell and any processes created by the shell after a limit is imposed. Note that some systems may
not allow limits to be increased once they are set. Also note that the types of limits available
are system dependent – some systems have only the -f limit.
|
-a Display all limits; unless -H is used, soft limits are displayed.
|
-B n Set the socket buffer size to n kibibytes.
|
-C n Set the number of cached threads to n.
|
-c n Impose a size limit of n blocks on the size of core dumps.
|
-d n Impose a size limit of n kibibytes on the size of the data area.
|
-e n Set the maximum niceness to n.
|
-f n Impose a size limit of n blocks on files written by the shell and its child processes (files
of any size may be read).
|
-H Set the hard limit only (the default is to set both hard and soft limits).
|
-i n Set the number of pending signals to n.
|
-L n Control flocks; documentation is missing.
|
-l n Impose a limit of n kibibytes on the amount of locked (wired) physical memory.
|
-M n Set the AIO locked memory to n kibibytes.
|
-m n Impose a limit of n kibibytes on the amount of physical memory used.
|
-n n Impose a limit of n file descriptors that can be open at once.
|
-O n Set the number of AIO operations to n.
|
-P n Limit the number of threads per process to n.
|
-p n Impose a limit of n processes that can be run by the user at any one time.
|
-q n Limit the size of POSIX message queues to n bytes.
|
-r n Set the maximum real-time priority to n.
|
-S Set the soft limit only (the default is to set both hard and soft limits).
|
-s n Impose a size limit of n kibibytes on the size of the stack area.
|
-T n Impose a time limit of n real seconds to be used by each process.
|
-t n Impose a time limit of n CPU seconds spent in user mode to be used by each process.
|
-V n Set the number of vnode monitors on Haiku to n.
|
-v n Impose a limit of n kibibytes on the amount of virtual memory (address space) used.
|
-w n Impose a limit of n kibibytes on the amount of swap space used.
|