1 .\" Copyright (c) 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
3 .\" Copyright (c) 1997-2005
4 .\" Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)sh.1 8.6 (Berkeley) 5/4/95
40 .Nd command interpreter (shell)
44 .Op Fl aCefnuvxIimqVEb
45 .Op Cm +aCefnuvxIimqVEb
48 .Op Fl o Ar option_name
49 .Op Cm +o Ar option_name
52 .Op Ar command_file Oo Ar argument ... Oc
57 .Op Fl aCefnuvxIimqVEb
58 .Op Cm +aCefnuvxIimqVEb
61 .Op Fl o Ar option_name
62 .Op Cm +o Ar option_name
66 .Op Ar command_name Oo Ar argument ... Oc
71 .Op Fl aCefnuvxIimqVEb
72 .Op Cm +aCefnuvxIimqVEb
75 .Op Fl o Ar option_name
76 .Op Cm +o Ar option_name
83 is the standard command interpreter for the system.
84 The current version of
86 is in the process of being changed to conform with the
88 1003.2 and 1003.2a specifications for the shell.
90 features which make it appear similar in some respects to the Korn shell,
91 but it is not a Korn shell clone (see
93 Only features designated by
95 plus a few Berkeley extensions, are being incorporated into this shell.
96 This man page is not intended
97 to be a tutorial or a complete specification of the shell.
99 The shell is a command that reads lines from either a file or the
100 terminal, interprets them, and generally executes other commands.
101 It is the program that is running when a user logs into the system
102 (although a user can select a different shell with the
105 The shell implements a language that has flow control
106 constructs, a macro facility that provides a variety of features in
107 addition to data storage, along with built in history and line editing
109 It incorporates many features to aid interactive use and
110 has the advantage that the interpretative language is common to both
111 interactive and non-interactive use (shell scripts).
113 can be typed directly to the running shell or can be put into a file and
114 the file can be executed directly by the shell.
116 If no args are present and if the standard input of the shell
117 is connected to a terminal (or if the
122 option is not present, the shell is considered an interactive shell.
123 An interactive shell generally prompts before each command and handles
124 programming and command errors differently (as described below).
126 the shell inspects argument 0, and if it begins with a dash
128 the shell is also considered
130 This is normally done automatically by the system
131 when the user first logs in.
132 A login shell first reads commands
138 If the environment variable
140 is set on entry to an interactive shell, or is set in the
142 of a login shell, the shell next reads
143 commands from the file named in
145 Therefore, a user should place commands that are to be executed only at
148 file, and commands that are executed for every interactive shell inside the
153 variable to some file, place the following line in your
155 of your home directory
157 .Dl ENV=$HOME/.shinit; export ENV
161 any filename you wish.
163 If command line arguments besides the options have been specified, then
164 the shell treats the first argument as the name of a file from which to
165 read commands (a shell script), and the remaining arguments are set as the
166 positional parameters of the shell ($1, $2, etc).
168 reads commands from its standard input.
169 .Ss Argument List Processing
170 All of the single letter options that have a corresponding name can be
171 used as an argument to the
176 name is provided next to the single letter option in
177 the description below.
180 turns the option on, while using a plus
183 The following options can be set from the command line or
186 builtin (described later).
187 .Bl -tag -width aaaallexportfoo -offset indent
188 .It Fl a Em allexport
189 Export all variables assigned to.
191 Read commands from the
193 operand instead of from the standard input.
194 Special parameter 0 will be set from the
196 operand and the positional parameters ($1, $2, etc.)
197 set from the remaining argument operands.
198 .It Fl C Em noclobber
199 Don't overwrite existing files with
202 If not interactive, exit immediately if any untested command fails.
203 The exit status of a command is considered to be
204 explicitly tested if the command is used to control an
210 or if the command is the left hand operand of an
216 Disable pathname expansion.
218 If not interactive, read commands but do not execute them.
219 This is useful for checking the syntax of shell scripts.
221 Write a message to standard error when attempting to expand a variable
222 that is not set, and if the shell is not interactive, exit immediately.
224 The shell writes its input to standard error as it is read.
225 Useful for debugging.
227 Write each command to standard error (preceded by a
229 before it is executed.
230 Useful for debugging.
231 .It Fl I Em ignoreeof
232 Ignore EOF's from input when interactive.
233 .It Fl i Em interactive
234 Force the shell to behave interactively.
236 Make dash act as if it had been invoked as a login shell.
238 Turn on job control (set automatically when interactive).
240 Read commands from standard input (set automatically if no file arguments
242 This option has no effect when set after the shell has
243 already started running (i.e. with
248 command line editor (disables
254 command line editor (disables
258 Enable asynchronous notification of background job completion.
259 (UNIMPLEMENTED for 4.4alpha)
261 .Ss Lexical Structure
262 The shell reads input in terms of lines from a file and breaks it up into
263 words at whitespace (blanks and tabs), and at certain sequences of
264 characters that are special to the shell called
266 There are two types of operators: control operators and redirection
267 operators (their meaning is discussed later).
268 Following is a list of operators:
269 .Bl -ohang -offset indent
270 .It "Control operators:"
271 .Dl & && \&( \&) \&; ;; | || \*[Lt]newline\*[Gt]
272 .It "Redirection operators:"
273 .Dl \*[Lt] \*[Gt] \*[Gt]| \*[Lt]\*[Lt] \*[Gt]\*[Gt] \*[Lt]& \*[Gt]& \*[Lt]\*[Lt]- \*[Lt]\*[Gt]
276 Quoting is used to remove the special meaning of certain characters or
277 words to the shell, such as operators, whitespace, or keywords.
278 There are three types of quoting: matched single quotes,
279 matched double quotes, and backslash.
281 A backslash preserves the literal meaning of the following
282 character, with the exception of
284 A backslash preceding a
286 is treated as a line continuation.
288 Enclosing characters in single quotes preserves the literal meaning of all
289 the characters (except single quotes, making it impossible to put
290 single-quotes in a single-quoted string).
292 Enclosing characters within double quotes preserves the literal
293 meaning of all characters except dollarsign
299 The backslash inside double quotes is historically weird, and serves to
300 quote only the following characters:
301 .Dl $ ` \*q \e \*[Lt]newline\*[Gt] .
302 Otherwise it remains literal.
304 Reserved words are words that have special meaning to the
305 shell and are recognized at the beginning of a line and
306 after a control operator.
307 The following are reserved words:
308 .Bl -column while while while while while -offset indent
309 .It ! Ta elif Ta fi Ta while Ta case
310 .It else Ta for Ta then Ta { Ta }
311 .It do Ta done Ta until Ta if Ta esac
314 Their meaning is discussed later.
316 An alias is a name and corresponding value set using the
319 Whenever a reserved word may occur (see above),
320 and after checking for reserved words, the shell
321 checks the word to see if it matches an alias.
322 If it does, it replaces it in the input stream with its value.
323 For example, if there is an alias called
329 .Dl lf foobar Aq return
333 .Dl ls -F foobar Aq return
335 Aliases provide a convenient way for naive users to create shorthands for
336 commands without having to learn how to create functions with arguments.
337 They can also be used to create lexically obscure code.
338 This use is discouraged.
340 The shell interprets the words it reads according to a language, the
341 specification of which is outside the scope of this man page (refer to the
345 Essentially though, a line is read and if the first
346 word of the line (or after a control operator) is not a reserved word,
347 then the shell has recognized a simple command.
349 command or some other special construct may have been recognized.
351 If a simple command has been recognized, the shell performs
352 the following actions:
353 .Bl -enum -offset indent
355 Leading words of the form
357 are stripped off and assigned to the environment of the simple command.
358 Redirection operators and their arguments (as described below) are
359 stripped off and saved for processing.
361 The remaining words are expanded as described in
364 and the first remaining word is considered the command name and the
366 The remaining words are considered the arguments of the command.
367 If no command name resulted, then the
369 variable assignments recognized in item 1 affect the current shell.
371 Redirections are performed as described in the next section.
374 Redirections are used to change where a command reads its input or sends
376 In general, redirections open, close, or duplicate an
377 existing reference to a file.
378 The overall format used for redirection is:
380 .Dl [n] Va redir-op Ar file
384 is one of the redirection operators mentioned previously.
385 Following is a list of the possible redirections.
388 is an optional number, as in
392 that refers to a file descriptor.
393 .Bl -tag -width aaabsfiles -offset indent
394 .It [n] Ns \*[Gt] file
395 Redirect standard output (or n) to file.
396 .It [n] Ns \*[Gt]| file
397 Same, but override the
400 .It [n] Ns \*[Gt]\*[Gt] file
401 Append standard output (or n) to file.
402 .It [n] Ns \*[Lt] file
403 Redirect standard input (or n) from file.
404 .It [n1] Ns \*[Lt]& Ns n2
405 Duplicate standard input (or n1) from file descriptor n2.
407 Close standard input (or n).
408 .It [n1] Ns \*[Gt]& Ns n2
409 Duplicate standard output (or n1) to n2.
411 Close standard output (or n).
412 .It [n] Ns \*[Lt]\*[Gt] file
413 Open file for reading and writing on standard input (or n).
416 The following redirection is often called a
418 .Bl -item -offset indent
420 .Li [n]\*[Lt]\*[Lt] delimiter
421 .Dl here-doc-text ...
425 All the text on successive lines up to the delimiter is saved away and
426 made available to the command on standard input, or file descriptor n if
428 If the delimiter as specified on the initial line is
429 quoted, then the here-doc-text is treated literally, otherwise the text is
430 subjected to parameter expansion, command substitution, and arithmetic
431 expansion (as described in the section on
437 then leading tabs in the here-doc-text are stripped.
438 .Ss Search and Execution
439 There are three types of commands: shell functions, builtin commands, and
440 normal programs -- and the command is searched for (by name) in that order.
441 They each are executed in a different way.
443 When a shell function is executed, all of the shell positional parameters
444 (except $0, which remains unchanged) are set to the arguments of the shell
446 The variables which are explicitly placed in the environment of
447 the command (by placing assignments to them before the function name) are
448 made local to the function and are set to the values given.
449 Then the command given in the function definition is executed.
450 The positional parameters are restored to their original values
451 when the command completes.
452 This all occurs within the current shell.
454 Shell builtins are executed internally to the shell, without spawning a
457 Otherwise, if the command name doesn't match a function or builtin, the
458 command is searched for as a normal program in the file system (as
459 described in the next section).
460 When a normal program is executed, the shell runs the program,
461 passing the arguments and the environment to the program.
462 If the program is not a normal executable file (i.e., if it does
463 not begin with the "magic number" whose
465 representation is "#!", so
469 then) the shell will interpret the program in a subshell.
470 The child shell will reinitialize itself in this case,
471 so that the effect will be as if a
472 new shell had been invoked to handle the ad-hoc shell script, except that
473 the location of hashed commands located in the parent shell will be
474 remembered by the child.
476 Note that previous versions of this document and the source code itself
477 misleadingly and sporadically refer to a shell script without a magic
478 number as a "shell procedure".
480 When locating a command, the shell first looks to see if it has a shell
481 function by that name.
482 Then it looks for a builtin command by that name.
483 If a builtin command is not found, one of two things happen:
486 Command names containing a slash are simply executed without performing
489 The shell searches each entry in
491 in turn for the command.
494 variable should be a series of entries separated by colons.
495 Each entry consists of a directory name.
496 The current directory may be indicated
497 implicitly by an empty directory name, or explicitly by a single period.
499 .Ss Command Exit Status
500 Each command has an exit status that can influence the behaviour
501 of other shell commands.
502 The paradigm is that a command exits
503 with zero for normal or success, and non-zero for failure,
504 error, or a false indication.
505 The man page for each command
506 should indicate the various exit codes and what they mean.
507 Additionally, the builtin commands return exit codes, as does
508 an executed shell function.
510 If a command consists entirely of variable assignments then the
511 exit status of the command is that of the last command substitution
514 Complex commands are combinations of simple commands with control
515 operators or reserved words, together creating a larger complex command.
516 More generally, a command is one of the following:
523 list or compound-list
530 Unless otherwise stated, the exit status of a command is that of the last
531 simple command executed by the command.
533 A pipeline is a sequence of one or more commands separated
534 by the control operator |.
535 The standard output of all but
536 the last command is connected to the standard input
538 The standard output of the last
539 command is inherited from the shell, as usual.
541 The format for a pipeline is:
543 .Dl [!] command1 [ | command2 ...]
545 The standard output of command1 is connected to the standard input of
547 The standard input, standard output, or both of a command is
548 considered to be assigned by the pipeline before any redirection specified
549 by redirection operators that are part of the command.
551 If the pipeline is not in the background (discussed later), the shell
552 waits for all commands to complete.
554 If the reserved word ! does not precede the pipeline, the exit status is
555 the exit status of the last command specified in the pipeline.
556 Otherwise, the exit status is the logical NOT of the exit status of the
558 That is, if the last command returns zero, the exit status
559 is 1; if the last command returns greater than zero, the exit status is
562 Because pipeline assignment of standard input or standard output or both
563 takes place before redirection, it can be modified by redirection.
566 .Dl $ command1 2\*[Gt]&1 | command2
568 sends both the standard output and standard error of command1
569 to the standard input of command2.
573 terminator causes the preceding AND-OR-list (described
574 next) to be executed sequentially; a & causes asynchronous execution of
575 the preceding AND-OR-list.
577 Note that unlike some other shells, each process in the pipeline is a
578 child of the invoking shell (unless it is a shell builtin, in which case
579 it executes in the current shell -- but any effect it has on the
580 environment is wiped).
581 .Ss Background Commands -- &
582 If a command is terminated by the control operator ampersand (&), the
583 shell executes the command asynchronously -- that is, the shell does not
584 wait for the command to finish before executing the next command.
586 The format for running a command in background is:
588 .Dl command1 & [command2 & ...]
590 If the shell is not interactive, the standard input of an asynchronous
593 .Ss Lists -- Generally Speaking
594 A list is a sequence of zero or more commands separated by newlines,
595 semicolons, or ampersands, and optionally terminated by one of these three
597 The commands in a list are executed in the order they are written.
598 If command is followed by an ampersand, the shell starts the
599 command and immediately proceed onto the next command; otherwise it waits
600 for the command to terminate before proceeding to the next one.
601 .Ss Short-Circuit List Operators
605 are AND-OR list operators.
607 executes the first command, and then executes the second command iff the
608 exit status of the first command is zero.
610 is similar, but executes the second command iff the exit status of the first
615 both have the same priority.
616 .Ss Flow-Control Constructs -- if, while, for, case
617 The syntax of the if command is
618 .Bd -literal -offset indent
627 The syntax of the while command is
628 .Bd -literal -offset indent
634 The two lists are executed repeatedly while the exit status of the
636 The until command is similar, but has the word
637 until in place of while, which causes it to
638 repeat until the exit status of the first list is zero.
640 The syntax of the for command is
641 .Bd -literal -offset indent
642 for variable [ in [ word ... ] ]
649 are expanded, and then the list is executed repeatedly with the
650 variable set to each word in turn.
651 Omitting in word ... is equivalent to in "$@".
653 The syntax of the break and continue command is
654 .Bd -literal -offset indent
659 Break terminates the num innermost for or while loops.
660 Continue continues with the next iteration of the innermost loop.
661 These are implemented as builtin commands.
663 The syntax of the case command is
664 .Bd -literal -offset indent
671 The pattern can actually be one or more patterns (see
673 described later), separated by
680 character before the pattern is optional.
681 .Ss Grouping Commands Together
682 Commands may be grouped by writing either
690 The first of these executes the commands in a subshell.
691 Builtin commands grouped into a (list) will not affect the current shell.
692 The second form does not fork another shell so is slightly more efficient.
693 Grouping commands together this way allows you to redirect
694 their output as though they were one program:
696 .Bd -literal -offset indent
697 { printf \*q hello \*q ; printf \*q world\\n" ; } \*[Gt] greeting
702 must follow a control operator (here,
704 so that it is recognized as a reserved word and not as another command argument.
706 The syntax of a function definition is
710 A function definition is an executable statement; when executed it
711 installs a function named name and returns an exit status of zero.
712 The command is normally a list enclosed between
717 Variables may be declared to be local to a function by using a local
719 This should appear as the first statement of a function, and the syntax is
721 .Dl local [ variable | - ] ...
723 Local is implemented as a builtin command.
725 When a variable is made local, it inherits the initial value and exported
726 and readonly flags from the variable with the same name in the surrounding
727 scope, if there is one.
728 Otherwise, the variable is initially unset.
729 The shell uses dynamic scoping, so that if you make the variable x local to
730 function f, which then calls function g, references to the variable x made
731 inside g will refer to the variable x declared inside f, not to the global
734 The only special parameter that can be made local is
738 local any shell options that are changed via the set command inside the
739 function to be restored to their original values when the function
742 The syntax of the return command is
744 .Dl return [ exitstatus ]
746 It terminates the currently executing function.
747 Return is implemented as a builtin command.
748 .Ss Variables and Parameters
749 The shell maintains a set of parameters.
750 A parameter denoted by a name is called a variable.
751 When starting up, the shell turns all the environment
752 variables into shell variables.
753 New variables can be set using the form
757 Variables set by the user must have a name consisting solely of
758 alphabetics, numerics, and underscores - the first of which must not be
760 A parameter can also be denoted by a number or a special
761 character as explained below.
762 .Ss Positional Parameters
763 A positional parameter is a parameter denoted by a number (n \*[Gt] 0).
764 The shell sets these initially to the values of its command line arguments
765 that follow the name of the shell script.
768 builtin can also be used to set or reset them.
769 .Ss Special Parameters
770 A special parameter is a parameter denoted by one of the following special
772 The value of the parameter is listed next to its character.
773 .Bl -tag -width thinhyphena
775 Expands to the positional parameters, starting from one.
777 expansion occurs within a double-quoted string it expands to a single
778 field with the value of each parameter separated by the first character of
787 Expands to the positional parameters, starting from one.
788 When the expansion occurs within double-quotes, each positional
789 parameter expands as a separate argument.
790 If there are no positional parameters, the
791 expansion of @ generates zero arguments, even when @ is
793 What this basically means, for example, is
804 .Dl \*q abc \*q \ \*q def\ ghi \*q
807 Expands to the number of positional parameters.
809 Expands to the exit status of the most recent pipeline.
811 Expands to the current option flags (the single-letter
812 option names concatenated into a string) as specified on
813 invocation, by the set builtin command, or implicitly
816 Expands to the process ID of the invoked shell.
817 A subshell retains the same value of $ as its parent.
819 Expands to the process ID of the most recent background
820 command executed from the current shell.
821 For a pipeline, the process ID is that of the last command in the pipeline.
823 Expands to the name of the shell or shell script.
826 This clause describes the various expansions that are performed on words.
827 Not all expansions are performed on every word, as explained later.
829 Tilde expansions, parameter expansions, command substitutions, arithmetic
830 expansions, and quote removals that occur within a single word expand to a
832 It is only field splitting or pathname expansion that can
833 create multiple fields from a single word.
834 The single exception to this
835 rule is the expansion of the special parameter @ within double-quotes, as
838 The order of word expansion is:
841 Tilde Expansion, Parameter Expansion, Command Substitution,
842 Arithmetic Expansion (these all occur at the same time).
844 Field Splitting is performed on fields
845 generated by step (1) unless the
849 Pathname Expansion (unless set
856 The $ character is used to introduce parameter expansion, command
857 substitution, or arithmetic evaluation.
858 .Ss Tilde Expansion (substituting a user's home directory)
859 A word beginning with an unquoted tilde character (~) is
860 subjected to tilde expansion.
861 All the characters up to
862 a slash (/) or the end of the word are treated as a username
863 and are replaced with the user's home directory.
864 If the username is missing (as in
866 the tilde is replaced with the value of the
868 variable (the current user's home directory).
869 .Ss Parameter Expansion
870 The format for parameter expansion is as follows:
874 where expression consists of all characters until the matching
878 escaped by a backslash or within a quoted string, and characters in
879 embedded arithmetic expansions, command substitutions, and variable
880 expansions, are not examined in determining the matching
883 The simplest form for parameter expansion is:
887 The value, if any, of parameter is substituted.
889 The parameter name or symbol can be enclosed in braces, which are
890 optional except for positional parameters with more than one digit or
891 when parameter is followed by a character that could be interpreted as
893 If a parameter expansion occurs inside double-quotes:
896 Pathname expansion is not performed on the results of the expansion.
898 Field splitting is not performed on the results of the
899 expansion, with the exception of @.
902 In addition, a parameter expansion can be modified by using one of the
904 .Bl -tag -width aaparameterwordaaaaa
905 .It ${parameter:-word}
907 If parameter is unset or null, the expansion of word
908 is substituted; otherwise, the value of parameter is substituted.
909 .It ${parameter:=word}
910 Assign Default Values.
911 If parameter is unset or null, the expansion of
912 word is assigned to parameter.
913 In all cases, the final value of parameter is substituted.
914 Only variables, not positional parameters or special
915 parameters, can be assigned in this way.
916 .It ${parameter:?[word]}
917 Indicate Error if Null or Unset.
918 If parameter is unset or null, the
919 expansion of word (or a message indicating it is unset if word is omitted)
920 is written to standard error and the shell exits with a nonzero exit status.
921 Otherwise, the value of parameter is substituted.
922 An interactive shell need not exit.
923 .It ${parameter:+word}
924 Use Alternative Value.
925 If parameter is unset or null, null is
926 substituted; otherwise, the expansion of word is substituted.
929 In the parameter expansions shown previously, use of the colon in the
930 format results in a test for a parameter that is unset or null; omission
931 of the colon results in a test for a parameter that is only unset.
932 .Bl -tag -width aaparameterwordaaaaa
935 The length in characters of the value of parameter.
938 The following four varieties of parameter expansion provide for substring
940 In each case, pattern matching notation (see
941 .Sx Shell Patterns ) ,
942 rather than regular expression notation, is used to evaluate the patterns.
943 If parameter is * or @, the result of the expansion is unspecified.
944 Enclosing the full parameter expansion string in double-quotes does not
945 cause the following four varieties of pattern characters to be quoted,
946 whereas quoting characters within the braces has this effect.
947 .Bl -tag -width aaparameterwordaaaaa
948 .It ${parameter%word}
949 Remove Smallest Suffix Pattern.
950 The word is expanded to produce a pattern.
951 The parameter expansion then results in parameter, with the
952 smallest portion of the suffix matched by the pattern deleted.
953 .It ${parameter%%word}
954 Remove Largest Suffix Pattern.
955 The word is expanded to produce a pattern.
956 The parameter expansion then results in parameter, with the largest
957 portion of the suffix matched by the pattern deleted.
958 .It ${parameter#word}
959 Remove Smallest Prefix Pattern.
960 The word is expanded to produce a pattern.
961 The parameter expansion then results in parameter, with the
962 smallest portion of the prefix matched by the pattern deleted.
963 .It ${parameter##word}
964 Remove Largest Prefix Pattern.
965 The word is expanded to produce a pattern.
966 The parameter expansion then results in parameter, with the largest
967 portion of the prefix matched by the pattern deleted.
969 .Ss Command Substitution
970 Command substitution allows the output of a command to be substituted in
971 place of the command name itself.
972 Command substitution occurs when the command is enclosed as follows:
984 The shell expands the command substitution by executing command in a
985 subshell environment and replacing the command substitution with the
986 standard output of the command, removing sequences of one or more
988 at the end of the substitution.
992 the end of the output are not removed; however, during field splitting,
993 they may be translated into
995 depending on the value of
997 and quoting that is in effect.)
998 .Ss Arithmetic Expansion
999 Arithmetic expansion provides a mechanism for evaluating an arithmetic
1000 expression and substituting its value.
1001 The format for arithmetic expansion is as follows:
1005 The expression is treated as if it were in double-quotes, except
1006 that a double-quote inside the expression is not treated specially.
1007 The shell expands all tokens in the expression for parameter expansion,
1008 command substitution, and quote removal.
1010 Next, the shell treats this as an arithmetic expression and
1011 substitutes the value of the expression.
1012 .Ss White Space Splitting (Field Splitting)
1013 After parameter expansion, command substitution, and
1014 arithmetic expansion the shell scans the results of
1015 expansions and substitutions that did not occur in double-quotes for
1016 field splitting and multiple fields can result.
1018 The shell treats each character of the
1020 as a delimiter and uses the delimiters to split the results of parameter
1021 expansion and command substitution into fields.
1022 .Ss Pathname Expansion (File Name Generation)
1025 flag is set, file name generation is performed after word splitting is
1027 Each word is viewed as a series of patterns, separated by slashes.
1028 The process of expansion replaces the word with the names of all
1029 existing files whose names can be formed by replacing each pattern with a
1030 string that matches the specified pattern.
1031 There are two restrictions on
1032 this: first, a pattern cannot match a string containing a slash, and
1033 second, a pattern cannot match a string starting with a period unless the
1034 first character of the pattern is a period.
1035 The next section describes the
1036 patterns used for both Pathname Expansion and the
1040 A pattern consists of normal characters, which match themselves,
1041 and meta-characters.
1042 The meta-characters are
1048 These characters lose their special meanings if they are quoted.
1049 When command or variable substitution is performed
1050 and the dollar sign or back quotes are not double quoted,
1051 the value of the variable or the output of
1052 the command is scanned for these characters and they are turned into
1057 matches any string of characters.
1058 A question mark matches any single character.
1061 introduces a character class.
1062 The end of the character class is indicated by a
1070 rather than introducing a character class.
1071 A character class matches any of the characters between the square brackets.
1072 A range of characters may be specified using a minus sign.
1073 The character class may be complemented
1074 by making an exclamation point the first character of the character class.
1078 in a character class, make it the first character listed (after the
1081 To include a minus sign, make it the first or last character listed.
1083 This section lists the builtin commands which are builtin because they
1084 need to perform some operation that can't be performed by a separate
1086 In addition to these, there are several other commands that may
1087 be builtin for efficiency (e.g.
1095 A null command that returns a 0 (true) exit value.
1097 The commands in the specified file are read and executed by the shell.
1098 .It alias Op Ar name Ns Op Ar "=string ..."
1101 is specified, the shell defines the alias
1107 is specified, the value of the alias
1110 With no arguments, the
1113 names and values of all defined aliases (see
1115 .It bg [ Ar job ] ...
1116 Continue the specified jobs (or the current job if no
1117 jobs are given) in the background.
1125 Execute the specified command but ignore shell functions when searching
1127 (This is useful when you
1128 have a shell function with the same name as a builtin command.)
1131 search for command using a
1133 that guarantees to find all the standard utilities.
1135 Do not execute the command but
1136 search for the command and print the resolution of the
1138 This is the same as the type builtin.
1140 Do not execute the command but
1141 search for the command and print the absolute pathname
1142 of utilities, the name for builtins or the expansion of aliases.
1148 Switch to the specified directory (default
1152 appears in the environment of the
1154 command or the shell variable
1156 is set and the directory name does not begin with a slash, then the
1157 directories listed in
1159 will be searched for the specified directory.
1162 is the same as that of
1164 If a single dash is specified as the argument, it will be replaced by the
1169 command will print out the name of the
1170 directory that it actually switched to if this is different from the name
1172 These may be different either because the
1174 mechanism was used or because the argument is a single dash.
1177 option causes the physical directory structure to be used, that is, all
1178 symbolic links are resolved to their respective values. The
1180 option turns off the effect of any preceding
1186 Print the arguments on the standard output, separated by spaces.
1189 option is present, a newline is output following the arguments.
1191 If any of the following sequences of characters is encountered during
1192 output, the sequence is not output. Instead, the specified action is
1194 .Bl -tag -width indent
1196 A backspace character is output.
1198 Subsequent output is suppressed. This is normally used at the end of the
1199 last argument to suppress the trailing newline that
1201 would otherwise output.
1205 Output a newline character.
1207 Output a carriage return.
1209 Output a (horizontal) tab character.
1211 Output a vertical tab.
1212 .It Li \e0 Ns Ar digits
1213 Output the character whose value is given by zero to three octal digits.
1214 If there are zero digits, a nul character is output.
1219 All other backslash sequences elicit undefined behaviour.
1220 .It eval Ar string ...
1221 Concatenate all the arguments with spaces.
1222 Then re-parse and execute the command.
1223 .It exec Op Ar command arg ...
1224 Unless command is omitted, the shell process is replaced with the
1225 specified program (which must be a real program, not a shell builtin or
1227 Any redirections on the
1229 command are marked as permanent, so that they are not undone when the
1232 .It exit Op Ar exitstatus
1233 Terminate the shell process.
1236 is given it is used as the exit status of the shell; otherwise the
1237 exit status of the preceding command is used.
1238 .It export Ar name ...
1240 The specified names are exported so that they will appear in the
1241 environment of subsequent commands.
1242 The only way to un-export a variable is to unset it.
1243 The shell allows the value of a variable to be set at the
1244 same time it is exported by writing
1246 .Dl export name=value
1248 With no arguments the export command lists the names of all exported variables.
1251 option specified the output will be formatted suitably for non-interactive use.
1252 .It Xo fc Op Fl e Ar editor
1253 .Op Ar first Op Ar last
1257 .Op Ar first Op Ar last
1259 .It Xo fc Fl s Op Ar old=new
1264 builtin lists, or edits and re-executes, commands previously entered
1265 to an interactive shell.
1268 Use the editor named by editor to edit the commands.
1269 The editor string is a command name, subject to search via the
1274 variable is used as a default when
1279 is null or unset, the value of the
1286 is used as the editor.
1288 List the commands rather than invoking an editor on them.
1289 The commands are written in the sequence indicated by
1290 the first and last operands, as affected by
1292 with each command preceded by the command number.
1294 Suppress command numbers when listing with -l.
1296 Reverse the order of the commands listed (with
1298 or edited (with neither
1303 Re-execute the command without invoking an editor.
1306 Select the commands to list or edit.
1307 The number of previous commands that
1308 can be accessed are determined by the value of the
1311 The value of first or last or both are one of the following:
1314 A positive number representing a command number; command numbers can be
1319 A negative decimal number representing the command that was executed
1320 number of commands previously.
1321 For example, \-1 is the immediately previous command.
1324 A string indicating the most recently entered command that begins with
1326 If the old=new operand is not also specified with
1328 the string form of the first operand cannot contain an embedded equal sign.
1331 The following environment variables affect the execution of fc:
1332 .Bl -tag -width HISTSIZE
1334 Name of the editor to use.
1336 The number of previous commands that are accessible.
1339 Move the specified job or the current job to the foreground.
1340 .It getopts Ar optstring var
1344 command, not to be confused with the
1349 The first argument should be a series of letters, each of which may be
1350 optionally followed by a colon to indicate that the option requires an
1352 The variable specified is set to the parsed option.
1356 command deprecates the older
1358 utility due to its handling of arguments containing whitespace.
1362 builtin may be used to obtain options and their arguments
1363 from a list of parameters.
1366 places the value of the next option from the option string in the list in
1367 the shell variable specified by
1369 and its index in the shell variable
1371 When the shell is invoked,
1373 is initialized to 1.
1374 For each option that requires an argument, the
1376 builtin will place it in the shell variable
1378 If an option is not allowed for in the
1385 is a string of recognized option letters (see
1387 If a letter is followed by a colon, the option is expected to have an
1388 argument which may or may not be separated from it by white space.
1389 If an option character is not found where expected,
1391 will set the variable
1398 and write output to standard error.
1399 By specifying a colon as the first character of
1401 all errors will be ignored.
1403 A nonzero value is returned when the last option is reached.
1404 If there are no remaining arguments,
1408 to the special option,
1410 otherwise, it will set
1415 The following code fragment shows how one might process the arguments
1416 for a command that can take the options
1422 which requires an argument.
1424 .Bd -literal -offset indent
1425 while getopts abc: f
1430 \\?) echo $USAGE; exit 1;;
1433 shift `expr $OPTIND - 1`
1436 This code will accept any of the following as equivalent:
1438 .Bd -literal -offset indent
1439 cmd \-acarg file file
1440 cmd \-a \-c arg file file
1441 cmd \-carg -a file file
1442 cmd \-a \-carg \-\- file file
1444 .It hash Fl rv Ar command ...
1445 The shell maintains a hash table which remembers the
1446 locations of commands.
1447 With no arguments whatsoever,
1450 command prints out the contents of this table.
1451 Entries which have not been looked at since the last
1453 command are marked with an asterisk; it is possible for these entries
1458 command removes the specified commands from the hash table (unless
1459 they are functions) and then locates them.
1462 option, hash prints the locations of the commands as it finds them.
1465 option causes the hash command to delete all the entries in the hash table
1466 except for functions.
1468 builtin command remembers what the current directory
1469 is rather than recomputing it each time.
1470 This makes it faster.
1471 However, if the current directory is renamed, the builtin version of
1473 will continue to print the old name for the directory.
1476 option causes the physical value of the current working directory to be shown,
1477 that is, all symbolic links are resolved to their respective values. The
1479 option turns off the effect of any preceding
1482 .It Xo read Op Fl p Ar prompt
1487 The prompt is printed if the
1489 option is specified and the standard input is a terminal.
1490 Then a line is read from the standard input.
1491 The trailing newline is deleted from the
1492 line and the line is split as described in the section on word splitting
1493 above, and the pieces are assigned to the variables in order.
1494 At least one variable must be specified.
1495 If there are more pieces than variables, the remaining pieces
1496 (along with the characters in
1498 that separated them) are assigned to the last variable.
1499 If there are more variables than pieces,
1500 the remaining variables are assigned the null string.
1503 builtin will indicate success unless EOF is encountered on input, in
1504 which case failure is returned.
1506 By default, unless the
1508 option is specified, the backslash
1510 acts as an escape character, causing the following character to be treated
1512 If a backslash is followed by a newline, the backslash and the
1513 newline will be deleted.
1514 .It readonly Ar name ...
1516 The specified names are marked as read only, so that they cannot be
1517 subsequently modified or unset.
1518 The shell allows the value of a variable
1519 to be set at the same time it is marked read only by writing
1521 .Dl readonly name=value
1523 With no arguments the readonly command lists the names of all read only
1527 option specified the output will be formatted suitably for non-interactive use.
1529 .It Xo printf Ar format
1530 .Op Ar arguments ...
1533 formats and prints its arguments, after the first, under control
1538 is a character string which contains three types of objects: plain characters,
1539 which are simply copied to standard output, character escape sequences which
1540 are converted and copied to the standard output, and format specifications,
1541 each of which causes printing of the next successive
1546 after the first are treated as strings if the corresponding format is
1552 otherwise it is evaluated as a C constant, with the following extensions:
1554 .Bl -bullet -offset indent -compact
1556 A leading plus or minus sign is allowed.
1558 If the leading character is a single or double quote, the value is the
1560 code of the next character.
1563 The format string is reused as often as necessary to satisfy the
1565 Any extra format specifications are evaluated with zero or the null
1568 Character escape sequences are in backslash notation as defined in
1570 The characters and their meanings are as follows:
1571 .Bl -tag -width Ds -offset indent
1573 Write a \*[Lt]bell\*[Gt] character.
1575 Write a \*[Lt]backspace\*[Gt] character.
1577 Write a \*[Lt]form-feed\*[Gt] character.
1579 Write a \*[Lt]new-line\*[Gt] character.
1581 Write a \*[Lt]carriage return\*[Gt] character.
1583 Write a \*[Lt]tab\*[Gt] character.
1585 Write a \*[Lt]vertical tab\*[Gt] character.
1587 Write a backslash character.
1589 Write an 8\-bit character whose
1591 value is the 1\-, 2\-, or 3\-digit
1596 Each format specification is introduced by the percent character
1598 The remainder of the format specification includes,
1599 in the following order:
1601 .It "Zero or more of the following flags:"
1605 specifying that the value should be printed in an ``alternative form''.
1612 formats, this option has no effect.
1615 format the precision of the number is increased to force the first
1616 character of the output string to a zero.
1620 format, a non-zero result has the string
1631 formats, the result will always contain a decimal point, even if no
1632 digits follow the point (normally, a decimal point only appears in the
1633 results of those formats if a digit follows the decimal point).
1638 formats, trailing zeros are not removed from the result as they
1641 A minus sign `\-' which specifies
1643 of the output in the indicated field;
1645 A `+' character specifying that there should always be
1646 a sign placed before the number when using signed formats.
1648 A space specifying that a blank should be left before a positive number
1649 for a signed format.
1650 A `+' overrides a space if both are used;
1652 A zero `0' character indicating that zero-padding should be used
1653 rather than blank-padding.
1654 A `\-' overrides a `0' if both are used;
1657 An optional digit string specifying a
1659 if the output string has fewer characters than the field width it will
1660 be blank-padded on the left (or right, if the left-adjustment indicator
1661 has been given) to make up the field width (note that a leading zero
1662 is a flag, but an embedded zero is part of a field width);
1666 followed by an optional digit string giving a
1668 which specifies the number of digits to appear after the decimal point,
1673 formats, or the maximum number of bytes to be printed
1680 formats); if the digit string is missing, the precision is treated
1683 A character which indicates the type of format to use (one of
1684 .Cm diouxXfwEgGbcs ) .
1687 A field width or precision may be
1689 instead of a digit string.
1692 supplies the field width or precision.
1694 The format characters and their meanings are:
1699 is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
1700 or unsigned hexadecimal (X or x), respectively.
1704 is printed in the style
1706 .Pf [\-]ddd Cm \&. No ddd
1708 where the number of d's
1709 after the decimal point is equal to the precision specification for
1711 If the precision is missing, 6 digits are given; if the precision
1712 is explicitly 0, no digits and no decimal point are printed.
1716 is printed in the style
1718 .Pf [\-]d Cm \&. No ddd Cm e No \*(Pmdd
1721 is one digit before the decimal point and the number after is equal to
1722 the precision specification for the argument; when the precision is
1723 missing, 6 digits are produced.
1724 An upper-case E is used for an `E' format.
1733 whichever gives full precision in minimum space.
1735 Characters from the string
1737 are printed with backslash-escape sequences expanded.
1739 The following additional backslash-escape sequences are supported:
1744 to ignore any remaining characters in the string operand containing it,
1745 any remaining string operands, and any additional characters in
1747 .It Cm \e0 Ns Ar num
1748 Write an 8\-bit character whose
1750 value is the 1\-, 2\-, or 3\-digit
1755 The first character of
1759 Characters from the string
1761 are printed until the end is reached or until the number of bytes
1762 indicated by the precision specification is reached; if the
1763 precision is omitted, all characters in the string are printed.
1765 Print a `%'; no argument is used.
1768 In no case does a non-existent or small field width cause truncation of
1769 a field; padding takes place only if the specified field width exceeds
1773 .Fl options | Cm +options | Cm -- }
1778 command performs three different functions.
1780 With no arguments, it lists the values of all shell variables.
1782 If options are given, it sets the specified option
1783 flags, or clears them as described in the section called
1784 .Sx Argument List Processing .
1785 As a special case, if the option is -o or +o and no argument is
1786 supplied, the shell prints the settings of all its options. If the
1787 option is -o, the settings are printed in a human-readable format; if
1788 the option is +o, the settings are printed in a format suitable for
1789 reinput to the shell to affect the same option settings.
1791 The third use of the set command is to set the values of the shell's
1792 positional parameters to the specified args.
1793 To change the positional
1794 parameters without changing any options, use
1796 as the first argument to set.
1797 If no args are present, the set command
1798 will clear all the positional parameters (equivalent to executing
1801 Shift the positional parameters n times.
1812 and so on, decreasing
1816 If n is greater than the number of positional parameters,
1818 will issue an error message, and exit with return status 2.
1819 .It test Ar expression
1820 .It \&[ Ar expression Cm ]
1823 utility evaluates the expression and, if it evaluates
1824 to true, returns a zero (true) exit status; otherwise
1825 it returns 1 (false).
1826 If there is no expression, test also
1829 All operators and flags are separate arguments to the
1833 The following primaries are used to construct expression:
1838 exists and is a block special
1843 exists and is a character
1848 exists and is a directory.
1852 exists (regardless of type).
1856 exists and is a regular file.
1860 exists and its set group ID flag
1865 exists and is a symbolic link.
1869 exists and its sticky bit is set.
1871 True if the length of
1882 exists and is readable.
1886 exists and has a size greater
1888 .It Fl t Ar file_descriptor
1889 True if the file whose file descriptor number
1892 is open and is associated with a terminal.
1896 exists and its set user ID flag
1901 exists and is writable.
1903 indicates only that the write flag is on.
1904 The file is not writable on a read-only file
1905 system even if this test indicates true.
1909 exists and is executable.
1911 indicates only that the execute flag is on.
1914 is a directory, true indicates that
1918 True if the length of
1924 exists and is a symbolic link.
1925 This operator is retained for compatibility with previous versions of
1927 Do not rely on its existence; use
1933 exists and its owner matches the effective user id of this process.
1937 exists and its group matches the effective group id of this process.
1941 exists and is a socket.
1942 .It Ar file1 Fl nt Ar file2
1951 .It Ar file1 Fl ot Ar file2
1960 .It Ar file1 Fl ef Ar file2
1965 exist and refer to the same file.
1971 .It Ar \&s\&1 Cm \&= Ar \&s\&2
1977 .It Ar \&s\&1 Cm \&!= Ar \&s\&2
1983 .It Ar \&s\&1 Cm \&\*[Lt] Ar \&s\&2
1988 based on the ASCII value of their characters.
1989 .It Ar \&s\&1 Cm \&\*[Gt] Ar \&s\&2
1994 based on the ASCII value of their characters.
1995 .It Ar \&n\&1 Fl \&eq Ar \&n\&2
1996 True if the integers
2002 .It Ar \&n\&1 Fl \&ne Ar \&n\&2
2003 True if the integers
2008 algebraically equal.
2009 .It Ar \&n\&1 Fl \> Ar \&n\&2
2013 greater than the integer
2015 .It Ar \&n\&1 Fl \&ge Ar \&n\&2
2019 greater than or equal to the integer
2021 .It Ar \&n\&1 Fl \< Ar \&n\&2
2024 is algebraically less
2027 .It Ar \&n\&1 Fl \&le Ar \&n\&2
2030 is algebraically less
2031 than or equal to the integer
2035 These primaries can be combined with the following operators:
2037 .It Cm \&! Ar expression
2041 .It Ar expression1 Fl a Ar expression2
2047 .It Ar expression1 Fl o Ar expression2
2053 .It Cm \&( Ns Ar expression Ns Cm \&)
2054 True if expression is true.
2059 operator has higher precedence than the
2063 Print the accumulated user and system times for the shell and for processes
2064 run from the shell. The return status is 0.
2066 .Op Ar action Ar signal ...
2068 Cause the shell to parse and execute action when any of the specified
2069 signals are received.
2070 The signals are specified by signal number or as the name of the signal.
2077 the action is executed when the shell exits.
2081 which causes the specified signals to be ignored.
2084 omitted or set to `-' the specified signals are set to their default action.
2085 When the shell forks off a subshell, it resets trapped (but not ignored)
2086 signals to the default action.
2089 command has no effect on signals that were
2090 ignored on entry to the shell.
2092 without any arguments cause it to write a list of signals and their
2093 associated action to the standard output in a format that is suitable
2094 as an input to the shell that achieves the same trapping results.
2100 List trapped signals and their corresponding action
2102 .Dl trap '' INT QUIT tstp 30
2104 Ignore signals INT QUIT TSTP USR1
2108 Print date upon receiving signal INT
2109 .It type Op Ar name ...
2110 Interpret each name as a command and print the resolution of the command
2112 Possible resolutions are:
2113 shell keyword, alias, shell builtin,
2114 command, tracked alias and not found.
2115 For aliases the alias expansion is
2116 printed; for commands and tracked aliases the complete pathname of the
2120 .Op Fl a \*(Ba Fl tfdscmlpn Op Ar value
2122 Inquire about or set the hard or soft limits on processes or set new
2124 The choice between hard limit (which no process is allowed to
2125 violate, and which may not be raised once it has been lowered) and soft
2126 limit (which causes processes to be signaled but not necessarily killed,
2127 and which may be raised) is made with these flags:
2130 set or inquire about hard limits
2132 set or inquire about soft limits.
2137 is specified, the soft limit is displayed or both limits are set.
2138 If both are specified, the last one wins.
2141 The limit to be interrogated or set, then, is chosen by specifying
2142 any one of these flags:
2145 show all the current limits
2147 show or set the limit on CPU time (in seconds)
2149 show or set the limit on the largest file that can be created
2150 (in 512-byte blocks)
2152 show or set the limit on the data segment size of a process (in kilobytes)
2154 show or set the limit on the stack size of a process (in kilobytes)
2156 show or set the limit on the largest core dump size that can be produced
2157 (in 512-byte blocks)
2159 show or set the limit on the total physical memory that can be
2160 in use by a process (in kilobytes)
2162 show or set the limit on how much memory a process can lock with
2166 show or set the limit on the number of processes this user can
2169 show or set the limit on the number files a process can have open at once
2171 show or set the limit on the real-time scheduling priority of a process
2174 If none of these is specified, it is the limit on file size that is shown
2176 If value is specified, the limit is set to that number; otherwise
2177 the current limit is displayed.
2179 Limits of an arbitrary process can be displayed or set using the
2183 .It umask Op Ar mask
2184 Set the value of umask (see
2186 to the specified octal value.
2187 If the argument is omitted, the umask value is printed.
2194 is specified, the shell removes that alias.
2197 is specified, all aliases are removed.
2202 The specified variables and functions are unset and unexported.
2207 is specified, the corresponding function or variable is unset, respectively.
2208 If a given name corresponds to both a variable and a function, and no
2209 options are given, only the variable is unset.
2211 Wait for the specified job to complete and return the exit status of the
2212 last process in the job.
2213 If the argument is omitted, wait for all jobs to
2214 complete and return an exit status of zero.
2216 .Ss Command Line Editing
2219 is being used interactively from a terminal, the current command
2220 and the command history (see
2224 can be edited using vi-mode command-line editing.
2225 This mode uses commands, described below,
2226 similar to a subset of those described in the vi man page.
2229 enables vi-mode editing and place sh into vi insert mode.
2231 enabled, sh can be switched between insert mode and command mode.
2232 The editor is not described in full here, but will be in a later document.
2233 It's similar to vi: typing
2235 will throw you into command VI command mode.
2238 while in command mode will pass the line to the shell.
2240 Errors that are detected by the shell, such as a syntax error, will cause the
2241 shell to exit with a non-zero exit status.
2242 If the shell is not an
2243 interactive shell, the execution of the shell file will be aborted.
2245 the shell will return the exit status of the last command executed, or
2246 if the exit builtin is used with a numeric argument, it will return the
2249 .Bl -tag -width MAILCHECK
2251 Set automatically by
2253 from the user's login directory in the password file
2255 This environment variable also functions as the default argument for the
2258 The default search path for executables.
2259 See the above section
2262 The search path used with the cd builtin.
2264 The name of a mail file, that will be checked for the arrival of new mail.
2268 The frequency in seconds that the shell checks for the arrival of mail
2269 in the files specified by the
2274 If set to 0, the check will occur at each prompt.
2278 separated list of file names, for the shell to check for incoming mail.
2279 This environment setting overrides the
2282 There is a maximum of 10 mailboxes that can be monitored at once.
2284 The primary prompt string, which defaults to
2286 unless you are the superuser, in which case it defaults to
2289 The secondary prompt string, which defaults to
2292 Output before each line when execution trace (set -x) is enabled,
2296 Input Field Separators.
2297 This is normally set to
2303 .Sx White Space Splitting
2304 section for more details.
2306 The default terminal setting for the shell.
2307 This is inherited by
2308 children of the shell, and is used in the history editing modes.
2310 The number of lines in the history buffer for the shell.
2312 The logical value of the current working directory. This is set by the
2316 The previous logical value of the current working directory. This is set by
2321 The process ID of the parent process of the shell.
2324 .Bl -item -width HOMEprofilexxxx
2345 is a POSIX-compliant implementation of /bin/sh that aims to be as small as
2348 is a direct descendant of the NetBSD version of ash (the Almquist SHell),
2349 ported to Linux in early 1997.
2354 Setuid shell scripts should be avoided at all costs, as they are a
2355 significant security risk.
2357 PS1, PS2, and PS4 should be subject to parameter expansion before