1 \input texinfo.tex @c -*- texinfo -*-
3 @setfilename features.info
4 @settitle Bash Features
8 last change: Thu Aug 4 15:21:56 EDT 1994
13 @set UPDATED 4 August 1994
14 @set UPDATE-MONTH August 1994
16 @setchapternewpage odd
21 This text is a brief description of the features that are present in
24 This is Edition @value{EDITION}, last updated @value{UPDATED},
25 of @cite{The GNU Bash Features Guide},
26 for @code{Bash}, Version @value{VERSION}.
28 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
30 This file is part of GNU Bash, the Bourne Again SHell.
32 Bash is free software; you can redistribute it and/or modify it
33 under the terms of the GNU General Public License as published by
34 the Free Software Foundation; either version 1, or (at your option)
37 Bash is distributed in the hope that it will be useful, but WITHOUT
38 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
39 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
40 License for more details.
42 You should have received a copy of the GNU General Public License
43 along with Bash; see the file COPYING. If not, write to the Free
44 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
51 @subtitle Overview Documentation for Bash
52 @subtitle Edition @value{EDITION}, for @code{bash} Version @value{VERSION}.
53 @subtitle @value{UPDATE-MONTH}
54 @author Brian Fox, Free Software Foundation
55 @author Chet Ramey, Case Western Reserve University
57 @vskip 0pt plus 1filll
58 Copyright @copyright{} 1991, 1993 Free Software Foundation, Inc.
65 Bash contains features that appear in other popular shells, and some
66 features that only appear in Bash. Some of the shells that Bash has
67 borrowed concepts from are the Bourne Shell (@file{sh}), the Korn Shell
68 (@file{ksh}), and the C-shell (@file{csh} and its successor,
69 @file{tcsh}). The following menu breaks the features up into
70 categories based upon which one of these other shells inspired the
73 This manual is meant as a brief introduction to features found in
74 Bash. The Bash manual page should be used as the definitive
75 reference on shell behavior.
78 * Bourne Shell Features:: Features originally found in the
81 * Csh Features:: Features originally found in the
84 * Korn Shell Features:: Features originally found in the Korn
87 * Bash Specific Features:: Features found only in Bash.
89 * Job Control:: A chapter describing what job control is
90 and how bash allows you to use it.
92 * Using History Interactively:: Chapter dealing with history expansion
95 * Command Line Editing:: Chapter describing the command line
98 * Variable Index:: Quick reference helps you find the
101 * Concept Index:: General index for this manual.
105 @node Bourne Shell Features
106 @chapter Bourne Shell Style Features
108 Bash is an acronym for Bourne Again SHell. The Bourne shell is
109 the traditional Unix shell originally written by Stephen Bourne.
110 All of the Bourne shell builtin commands are available in Bash,
111 and the rules for evaluation and quoting are taken from the Posix
112 1003.2 specification for the `standard' Unix shell.
114 This section briefly summarizes things which Bash inherits from
115 the Bourne shell: shell control structures, builtins, variables,
116 and other features. It also lists the significant differences
117 between Bash and the Bourne Shell.
120 * Looping Constructs:: Shell commands for iterative action.
121 * Conditional Constructs:: Shell commands for conditional execution.
122 * Shell Functions:: Grouping commands by name.
123 * Bourne Shell Builtins:: Builtin commands inherited from the Bourne
125 * Bourne Shell Variables:: Variables which Bash uses in the same way
127 * Other Bourne Shell Features:: Addtional aspects of Bash which behave in
128 the same way as the Bourne Shell.
131 @node Looping Constructs
132 @section Looping Constructs
134 Note that wherever you see a @samp{;} in the description of a
135 command's syntax, it may be replaced indiscriminately with
136 one or more newlines.
138 Bash supports the following looping constructs.
142 The syntax of the @code{until} command is:
144 until @var{test-commands}; do @var{consequent-commands}; done
146 Execute @var{consequent-commands} as long as the final command in
147 @var{test-commands} has an exit status which is not zero.
150 The syntax of the @code{while} command is:
152 while @var{test-commands}; do @var{consequent-commands}; done
155 Execute @var{consequent-commands} as long as the final command in
156 @var{test-commands} has an exit status of zero.
159 The syntax of the for command is:
162 for @var{name} [in @var{words} ...]; do @var{commands}; done
164 Execute @var{commands} for each member in @var{words}, with @var{name}
165 bound to the current member. If ``@code{in @var{words}}'' is not
166 present, ``@code{in "$@@"}'' is assumed.
170 @node Conditional Constructs
171 @section Conditional Constructs
175 The syntax of the @code{if} command is:
178 if @var{test-commands}; then
179 @var{consequent-commands};
180 [elif @var{more-test-commands}; then
181 @var{more-consequents};]
182 [else @var{alternate-consequents};]
186 Execute @var{consequent-commands} only if the final command in
187 @var{test-commands} has an exit status of zero.
188 Otherwise, each @code{elif} list is executed in turn,
189 and if its exit status is zero,
190 the corresponding @var{more-consequents} is executed and the
192 If ``@code{else @var{alternate-consequents}}'' is present, and
193 the final command in the final @code{if} or @code{elif} clause
194 has a non-zero exit status, then execute @var{alternate-consequents}.
197 The syntax of the @code{case} command is:
200 @code{case @var{word} in [@var{pattern} [| @var{pattern}]...) @var{commands} ;;]... esac}
203 Selectively execute @var{commands} based upon @var{word} matching
204 @var{pattern}. The `@code{|}' is used to separate multiple patterns.
206 Here is an example using @code{case} in a script that could be used to
207 describe an interesting feature of an animal:
210 echo -n "Enter the name of an animal: "
212 echo -n "The $ANIMAL has "
214 horse | dog | cat) echo -n "four";;
215 man | kangaroo ) echo -n "two";;
216 *) echo -n "an unknown number of";;
223 @node Shell Functions
224 @section Shell Functions
226 Shell functions are a way to group commands for later execution
227 using a single name for the group. They are executed just like
228 a "regular" command. Shell functions are executed in the current
229 shell context; no new process is created to interpret them.
231 Functions are declared using this syntax:
234 [ @code{function} ] @var{name} () @{ @var{command-list}; @}
237 This defines a function named @var{name}. The @var{body} of the
238 function is the @var{command-list} between @{ and @}. This list
239 is executed whenever @var{name} is specified as the
240 name of a command. The exit status of a function is
241 the exit status of the last command executed in the body.
243 When a function is executed, the arguments to the
244 function become the positional parameters
245 during its execution. The special parameter
246 @code{#} that gives the number of positional parameters
247 is updated to reflect the change. Positional parameter 0
250 If the builtin command @code{return}
251 is executed in a function, the function completes and
252 execution resumes with the next command after the function
253 call. When a function completes, the values of the
254 positional parameters and the special parameter @code{#}
255 are restored to the values they had prior to function
258 @node Bourne Shell Builtins
259 @section Bourne Shell Builtins
261 The following shell builtin commands are inherited from the Bourne
262 shell. These commands are implemented as specified by the Posix
267 Do nothing beyond expanding any arguments and performing redirections.
269 Read and execute commands from the @var{filename} argument in the
270 current shell context.
272 Exit from a @code{for}, @code{while}, or @code{until} loop.
274 Change the current working directory.
276 Resume the next iteration of an enclosing @code{for}, @code{while},
277 or @code{until} loop.
279 Print the arguments, separated by spaces, to the standard output.
281 The arguments are concatenated together into a single
282 command, which is then read and executed.
284 If a @var{command} argument
285 is supplied, it replaces the shell. If no
286 @var{command} is specified, redirections may be used to affect
287 the current shell environment.
291 Mark the arguments as variables to be passed to child processes
294 Parse options to shell scripts or functions.
296 Remember the full pathnames of commands specified as arguments,
297 so they need not be searched for on subsequent invocations.
299 Send a signal to a process.
301 Print the current working directory.
303 Read a line from the shell input and use it to set the values of
306 Mark variables as unchangable.
308 Cause a shell function to exit with a specified value.
310 Shift positional parameters to the left.
313 Evaluate a conditional expression.
315 Print out the user and system times used by the shell and its children.
317 Specify commands to be executed when the shell receives signals.
319 Set the shell process's file creation mask.
321 Cause shell variables to disappear.
323 Wait until child processes exit and report their exit status.
326 @node Bourne Shell Variables
327 @section Bourne Shell Variables
329 Bash uses certain shell variables in the same way as the Bourne shell.
330 In some cases, Bash assigns a default value to the variable.
335 A list of characters that separate fields; used when the shell splits
336 words as part of expansion.
339 A colon-separated list of directories in which the shell looks for
343 The current user's home directory.
346 A colon-separated list of directories used as a search path for
347 the @code{cd} command.
350 A colon-separated list of files which the shell periodically checks
351 for new mail. You can
352 also specify what message is printed by separating the file name from
353 the message with a @samp{?}. When used in the text of the message,
354 @code{$_} stands for the name of the current mailfile.
357 The primary prompt string.
360 The secondary prompt string.
363 The index of the last option processed by the
364 @code{getopts} builtin.
367 The value of the last option argument processed by the
368 @code{getopts} builtin.
372 @node Other Bourne Shell Features
373 @section Other Bourne Shell Features
376 * Major Differences from the Bourne Shell:: Major differences between
377 Bash and the Bourne shell.
380 Bash implements essentially the same grammar, parameter and variable
381 expansion, redirection, and quoting as the Bourne Shell. Bash uses the
382 Posix 1003.2 standard as the specification of how these features are to be
383 implemented. There are some differences between the traditional Bourne
384 shell and the Posix standard; this section quickly details the differences
385 of significance. A number of these differences are explained in greater
386 depth in subsequent sections.
388 @node Major Differences from the Bourne Shell
389 @subsection Major Differences from the Bourne Shell
391 Bash implements the @code{!} keyword to negate the return value of
392 a pipeline. Very useful when an @code{if} statement needs to act
393 only if a test fails.
395 Bash includes brace expansion (@pxref{Brace Expansion}).
397 Bash includes the Posix and @code{ksh}-style pattern removal @code{%%} and
398 @code{##} constructs to remove leading or trailing substrings from
401 The Posix and @code{ksh}-style @code{$()} form of command substitution is
402 implemented, and preferred to the Bourne shell's @code{``} (which
403 is also implemented for backwards compatibility).
405 Variables present in the shell's initial environment are automatically
406 exported to child processes. The Bourne shell does not normally do
407 this unless the variables are explicitly marked using the @code{export}
410 The expansion @code{$@{#xx@}}, which returns the length of @code{$xx},
413 The @code{IFS} variable is used to split only the results of expansion,
414 not all words. This closes a longstanding shell security hole.
416 It is possible to have a variable and a function with the same name;
417 @code{sh} does not separate the two name spaces.
419 Bash functions are permitted to have local variables, and thus useful
420 recursive functions may be written.
422 The @code{noclobber} option is available to avoid overwriting existing
423 files with output redirection.
425 Bash allows you to write a function to override a builtin, and provides
426 access to that builtin's functionality within the function via the
427 @code{builtin} and @code{command} builtins.
429 The @code{command} builtin allows selective disabling of functions
430 when command lookup is performed.
432 Individual builtins may be enabled or disabled using the @code{enable}
435 Functions may be exported to children via the environment.
437 The Bash @code{read} builtin will read a line ending in @key{\} with
438 the @code{-r} option, and will use the @code{$REPLY} variable as a
439 default if no arguments are supplied.
441 The @code{return} builtin may be used to abort execution of scripts
442 executed with the @code{.} or @code{source} builtins.
444 The @code{umask} builtin allows symbolic mode arguments similar to
445 those accepted by @code{chmod}.
447 The @code{test} builtin is slightly different, as it implements the
448 Posix 1003.2 algorithm, which specifies the behavior based on the
452 @chapter C-Shell Style Features
454 The C-Shell (@dfn{@code{csh}}) was created by Bill Joy at UC Berkeley. It
455 is generally considered to have better features for interactive use than
456 the original Bourne shell. Some of the @code{csh} features present in
457 Bash include job control, history expansion, `protected' redirection, and
458 several variables for controlling the interactive behaviour of the shell
459 (e.g. @code{IGNOREEOF}).
461 @xref{Using History Interactively} for details on history expansion.
464 * Tilde Expansion:: Expansion of the ~ character.
465 * Brace Expansion:: Expansion of expressions within braces.
466 * C Shell Builtins:: Builtin commands adopted from the C Shell.
467 * C Shell Variables:: Variables which Bash uses in essentially
468 the same way as the C Shell.
471 @node Tilde Expansion
472 @section Tilde Expansion
474 Bash has tilde (~) expansion, similar, but not identical, to that of
475 @code{csh}. The following table shows what unquoted words beginning
476 with a tilde expand to.
480 The current value of @code{$HOME}.
485 The subdirectory @code{foo} of the home directory of the user
495 Bash will also tilde expand words following redirection operators
496 and words following @samp{=} in assignment statements.
498 @node Brace Expansion
499 @section Brace Expansion
502 is a mechanism by which arbitrary strings
503 may be generated. This mechanism is similar to
504 @var{pathname expansion} (see the Bash manual
505 page for details), but the file names generated
506 need not exist. Patterns to be brace expanded take
507 the form of an optional @var{preamble},
508 followed by a series of comma-separated strings
509 between a pair of braces, followed by an optional @var{postamble}.
510 The preamble is prepended to each string contained
511 within the braces, and the postamble is then appended
512 to each resulting string, expanding left to right.
514 Brace expansions may be nested. The results of each expanded
515 string are not sorted; left to right order is preserved.
523 Brace expansion is performed before any other expansions,
524 and any characters special to other expansions are preserved
525 in the result. It is strictly textual. Bash
526 does not apply any syntactic interpretation to the context of the
527 expansion or the text between the braces.
529 A correctly-formed brace expansion must contain unquoted opening
530 and closing braces, and at least one unquoted comma.
531 Any incorrectly formed brace expansion is left unchanged.
533 This construct is typically used as shorthand when the common
534 prefix of the strings to be generated is longer than in the
537 mkdir /usr/local/src/bash/@{old,new,dist,bugs@}
541 chown root /usr/@{ucb/@{ex,edit@},lib/@{ex?.?*,how_ex@}@}
544 @node C Shell Builtins
545 @section C Shell Builtins
547 Bash has several builtin commands whose definition is very similar
553 pushd [@var{dir} | @var{+n} | @var{-n}]
556 Save the current directory on a list and then @code{cd} to
558 arguments, exchanges the top two directories.
562 Brings the @var{n}th directory (counting from the left of the
563 list printed by @code{dirs}) to the top of the list by rotating
566 Brings the @var{n}th directory (counting from the right of the
567 list printed by @code{dirs}) to the top of the list by rotating
570 Makes the current working directory be the top of the stack, and then
571 @var{cd}s to @var{dir}. You can see the saved directory list
572 with the @code{dirs} command.
577 popd [+@var{n} | -@var{n}]
580 Pops the directory stack, and @code{cd}s to the new top directory. When
581 no arguments are given, removes the top directory from the stack and
582 @code{cd}s to the new top directory. The
583 elements are numbered from 0 starting at the first directory listed with
584 @code{dirs}; i.e. @code{popd} is equivalent to @code{popd +0}.
587 Removes the @var{n}th directory (counting from the left of the
588 list printed by @code{dirs}), starting with zero.
590 Removes the @var{n}th directory (counting from the right of the
591 list printed by @code{dirs}), starting with zero.
596 dirs [+@var{n} | -@var{n}] [-@var{l}]
598 Display the list of currently remembered directories. Directories
599 find their way onto the list with the @code{pushd} command; you can get
600 back up through the list with the @code{popd} command.
603 Displays the @var{n}th directory (counting from the left of the
604 list printed by @code{dirs} when invoked without options), starting
607 Displays the @var{n}th directory (counting from the right of the
608 list printed by @code{dirs} when invoked without options), starting
611 Produces a longer listing; the default listing format uses a
612 tilde to denote the home directory.
618 history [@var{n}] [ [-w -r -a -n] [@var{filename}]]
621 Display the history list with line numbers. Lines prefixed with
622 with a @code{*} have been modified. An argument of @var{n} says
623 to list only the last @var{n} lines. Option @code{-w} means
624 write out the current history to the history file; @code{-r}
625 means to read the current history file and make its contents the
626 history list. An argument of @code{-a} means to append the new
627 history lines (history lines entered since the beginning of the
628 current Bash session) to the history file. Finally, the
629 @code{-n} argument means to read the history lines not already
630 read from the history file into the current history list. These
631 are lines appended to the history file since the beginning of the
632 current Bash session. If @var{filename} is given, then it is used
633 as the history file, else if @code{$HISTFILE} has a value,
634 that is used, otherwise @file{~/.bash_history} is used.
640 A synonym for @code{.} (@pxref{Bourne Shell Builtins})
644 @node C Shell Variables
645 @section C Shell Variables
650 If this variable is set, it represents the number of consecutive
651 @code{EOF}s Bash will read before exiting. By default, Bash will exit
652 upon reading a single @code{EOF}.
655 If this variable is set, Bash treats arguments to the @code{cd} command
656 which are not directories as names of variables whose values are the
657 directories to change to.
660 @node Korn Shell Features
661 @chapter Korn Shell Style Features
663 This section describes features primarily inspired by the
664 Korn Shell (@code{ksh}). In some cases, the Posix 1003.2
665 standard has adopted these commands and variables from the
666 Korn Shell; Bash implements those features using the Posix
670 * Korn Shell Constructs:: Shell grammar constructs adopted from the
672 * Korn Shell Builtins:: Builtin commands adopted from the Korn Shell.
673 * Korn Shell Variables:: Variables which bash uses in essentially
674 the same way as the Korn Shell.
675 * Aliases:: Substituting one command for another.
678 @node Korn Shell Constructs
679 @section Korn Shell Constructs
681 Bash includes the Korn Shell @code{select} construct. This construct
682 allows the easy generation of menus. It has almost the same syntax as
683 the @code{for} command.
685 The syntax of the @code{select} command is:
687 select @var{name} [in @var{words} ...]; do @var{commands}; done
690 The list of words following @code{in} is expanded, generating a list
691 of items. The set of expanded words is printed on the standard
692 error, each preceded by a number. If the ``@code{in @var{words}}''
693 is omitted, the positional parameters are printed. The
694 @code{PS3} prompt is then displayed and a line is read from the standard
695 input. If the line consists of the number corresponding to one of
696 the displayed words, then the value of @var{name}
697 is set to that word. If the line is empty, the words and prompt
698 are displayed again. If @code{EOF} is read, the @code{select}
699 command completes. Any other value read causes @var{name}
700 to be set to null. The line read is saved in the variable
703 The @var{commands} are executed after each selection until a
704 @code{break} or @code{return} command is executed, at which
705 point the @code{select} command completes.
707 @node Korn Shell Builtins
708 @section Korn Shell Builtins
710 This section describes Bash builtin commands taken from @code{ksh}.
716 @code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
717 @code{fc -s [@var{pat=rep}] [@var{command}]}
720 Fix Command. In the first form, a range of commands from @var{first} to
721 @var{last} is selected from the history list. Both @var{first} and
722 @var{last} may be specified as a string (to locate the most recent
723 command beginning with that string) or as a number (an index into the
724 history list, where a negative number is used as an offset from the
725 current command number). If @var{last} is not specified it is set to
726 @var{first}. If @var{first} is not specified it is set to the previous
727 command for editing and -16 for listing. If the @code{-l} flag is
728 given, the commands are listed on standard output. The @code{-n} flag
729 suppresses the command numbers when listing. The @code{-r} flag
730 reverses the order of the listing. Otherwise, the editor given by
731 @var{ename} is invoked on a file containing those commands. If
732 @var{ename} is not given, the value of the following variable expansion
733 is used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}. This says to use the
734 value of the @code{FCEDIT} variable if set, or the value of the
735 @code{EDITOR} variable if that is set, or @code{vi} if neither is set.
736 When editing is complete, the edited commands are echoed and executed.
738 In the second form, @var{command} is re-executed after each instance
739 of @var{pat} in the selected command is replaced by @var{rep}.
741 A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
742 that typing @code{r cc} runs the last command beginning with @code{cc}
743 and typing @code{r} re-executes the last command (@pxref{Aliases}).
746 The @code{let} builtin allows arithmetic to be performed on shell variables.
747 For details, refer to @ref{Arithmetic Builtins}.
750 The @code{typeset} command is supplied for compatibility with the Korn
751 shell; however, it has been made obsolete by the
752 @code{declare} command (@pxref{Bash Builtins}).
756 @node Korn Shell Variables
757 @section Korn Shell Variables
762 The default variable for the @code{read} builtin.
765 Each time this parameter is referenced, a random integer
766 is generated. Assigning a value to this variable seeds
767 the random number generator.
770 This variable expands to the number of seconds since the
771 shell was started. Assignment to this variable resets
772 the count to the value assigned, and the expanded value
773 becomes the value assigned plus the number of seconds
774 since the assignment.
777 The value of this variable is used as the prompt for the
778 @code{select} command.
781 This is the prompt printed before the command line is echoed
782 when the @code{-x} option is set (@pxref{The Set Builtin}).
785 The current working directory as set by the @code{cd} builtin.
788 The previous working directory as set by the @code{cd} builtin.
791 If set to a value greater than zero, the value is interpreted as
792 the number of seconds to wait for input after issuing the primary
794 Bash terminates after that number of seconds if input does
803 * Alias Builtins:: Builtins commands to maniuplate aliases.
806 The shell maintains a list of @var{aliases}
807 that may be set and unset with the @code{alias} and
808 @code{unalias} builtin commands.
810 The first word of each command, if unquoted,
811 is checked to see if it has an
812 alias. If so, that word is replaced by the text of the alias.
813 The alias name and the replacement text may contain any valid
814 shell input, including shell metacharacters, with the exception
815 that the alias name may not contain @key{=}.
816 The first word of the replacement text is tested for
817 aliases, but a word that is identical to an alias being expanded
818 is not expanded a second time. This means that one may alias
819 @code{ls} to @code{"ls -F"},
820 for instance, and Bash does not try to recursively expand the
821 replacement text. If the last character of the alias value is a
822 space or tab character, then the next command word following the
823 alias is also checked for alias expansion.
825 Aliases are created and listed with the @code{alias}
826 command, and removed with the @code{unalias} command.
828 There is no mechanism for using arguments in the replacement text,
830 If arguments are needed, a shell function should be used.
832 Aliases are not expanded when the shell is not interactive.
834 The rules concerning the definition and use of aliases are
835 somewhat confusing. Bash
836 always reads at least one complete line
837 of input before executing any
838 of the commands on that line. Aliases are expanded when a
839 command is read, not when it is executed. Therefore, an
840 alias definition appearing on the same line as another
841 command does not take effect until the next line of input is read.
842 This means that the commands following the alias definition
843 on that line are not affected by the new alias.
844 This behavior is also an issue when functions are executed.
845 Aliases are expanded when the function definition is read,
846 not when the function is executed, because a function definition
847 is itself a compound command. As a consequence, aliases
848 defined in a function are not available until after that
849 function is executed. To be safe, always put
850 alias definitions on a separate line, and do not use @code{alias}
851 in compound commands.
853 Note that for almost every purpose, aliases are superseded by
857 @subsection Alias Builtins
862 alias [@var{name}[=@var{value}] ...]
865 Without arguments, print the list of aliases on the standard output.
866 If arguments are supplied, an alias is defined for each @var{name}
867 whose @var{value} is given. If no @var{value} is given, the name
868 and value of the alias is printed.
872 unalias [-a] [@var{name} ... ]
875 Remove each @var{name} from the list of aliases. If @code{-a} is
876 supplied, all aliases are removed.
879 @node Bash Specific Features
880 @chapter Bash Specific Features
882 This section describes the features unique to Bash.
885 * Invoking Bash:: Command line options that you can give
887 * Bash Startup Files:: When and how Bash executes scripts.
888 * Is This Shell Interactive?:: Determining the state of a running Bash.
889 * Bash Builtins:: Table of builtins specific to Bash.
890 * The Set Builtin:: This builtin is so overloaded it
891 deserves its own section.
892 * Bash Variables:: List of variables that exist in Bash.
893 * Shell Arithmetic:: Arithmetic on shell variables.
894 * Printing a Prompt:: Controlling the PS1 string.
898 @section Invoking Bash
900 In addition to the single-character shell command-line options
901 (@pxref{The Set Builtin}), there are several multi-character
902 options that you can use. These options must appear on the command
903 line before the single-character options to be recognized.
907 Don't read the @file{~/.bashrc} initialization file in an
908 interactive shell. This is on by default if the shell is
909 invoked as @code{sh}.
911 @item -rcfile @var{filename}
912 Execute commands from @var{filename} (instead of @file{~/.bashrc})
913 in an interactive shell.
916 Don't load the system-wide startup file @file{/etc/profile}
917 or any of the personal initialization files
918 @file{~/.bash_profile}, @file{~/.bash_login}, or @file{~/.profile}
919 when bash is invoked as a login shell.
922 Display the version number of this shell.
925 Make this shell act as if it were directly invoked from login.
926 This is equivalent to @samp{exec - bash} but can be issued from
927 another shell, such as @code{csh}. If you wanted to replace your
928 current login shell with a Bash login shell, you would say
929 @samp{exec bash -login}.
931 @item -nobraceexpansion
932 Do not perform curly brace expansion (@pxref{Brace Expansion}).
935 Do not use the GNU Readline library (@pxref{Command Line Editing})
936 to read interactive command lines.
939 Change the behavior of Bash where the default operation differs
940 from the Posix 1003.2 standard to match the standard. This
941 is intended to make Bash behave as a strict superset of that
946 There are several single-character options you can give which are
947 not available with the @code{set} builtin.
950 @item -c @var{string}
951 Read and execute commands from @var{string} after processing the
955 Force the shell to run interactively.
958 If this flag is present, or if no arguments remain after option
959 processing, then commands are read from the standard input.
960 This option allows the positional parameters to be set
961 when invoking an interactive shell.
965 An @emph{interactive} shell is one whose input and output are both
966 connected to terminals (as determined by @code{isatty()}), or one
967 started with the @code{-i} option.
969 @node Bash Startup Files
970 @section Bash Startup Files
972 When and how Bash executes startup files.
975 For Login shells (subject to the -noprofile option):
978 If @file{/etc/profile} exists, then source it.
980 If @file{~/.bash_profile} exists, then source it,
981 else if @file{~/.bash_login} exists, then source it,
982 else if @file{~/.profile} exists, then source it.
985 If @file{~/.bash_logout} exists, source it.
987 For non-login interactive shells (subject to the -norc and -rcfile options):
989 If @file{~/.bashrc} exists, then source it.
991 For non-interactive shells:
993 If the environment variable @code{ENV} is non-null, expand the
994 variable and source the file named by the value. If Bash is
995 not started in Posix mode, it looks for @code{BASH_ENV} before
999 So, typically, your @code{~/.bash_profile} contains the line
1001 @code{if [ -f @code{~/.bashrc} ]; then source @code{~/.bashrc}; fi}
1004 after (or before) any login specific initializations.
1006 If Bash is invoked as @code{sh}, it tries to mimic the behavior of
1007 @code{sh} as closely as possible. For a login shell, it attempts to
1008 source only @file{/etc/profile} and @file{~/.profile}, in that order.
1009 The @code{-noprofile} option may still be used to disable this behavior.
1010 A shell invoked as @code{sh} does not attempt to source any other
1013 When Bash is started in @var{POSIX} mode, as with the
1014 @code{-posix} command line option, it follows the Posix 1003.2
1015 standard for startup files. In this mode, the @code{ENV}
1016 variable is expanded and that file sourced; no other startup files
1019 @node Is This Shell Interactive?
1020 @section Is This Shell Interactive?
1022 You may wish to determine within a startup script whether Bash is
1023 running interactively or not. To do this, examine the variable
1024 @code{$PS1}; it is unset in non-interactive shells, and set in
1025 interactive shells. Thus:
1028 if [ -z "$PS1" ]; then
1029 echo This shell is not interactive
1031 echo This shell is interactive
1035 You can ask an interactive Bash to not run your @file{~/.bashrc} file
1036 with the @code{-norc} flag. You can change the name of the
1037 @file{~/.bashrc} file to any other file name with @code{-rcfile
1038 @var{filename}}. You can ask Bash to not run your
1039 @file{~/.bash_profile} file with the @code{-noprofile} flag.
1042 @section Bash Builtin Commands
1044 This section describes builtin commands which are unique to
1045 or have been extended in Bash.
1050 builtin [@var{shell-builtin} [@var{args}]]
1052 Run a shell builtin. This is useful when you wish to rename a
1053 shell builtin to be a function, but need the functionality of the
1054 builtin within the function itself.
1058 bind [-m @var{keymap}] [-lvd] [-q @var{name}]
1059 bind [-m @var{keymap}] -f @var{filename}
1060 bind [-m @var{keymap}] @var{keyseq:function-name}
1063 Display current Readline (@pxref{Command Line Editing})
1064 key and function bindings, or
1065 bind a key sequence to a Readline function or macro. The
1066 binding syntax accepted is identical to that of
1067 @file{.inputrc} (@pxref{Readline Init File}),
1068 but each binding must be passed as a separate argument:
1069 @samp{"\C-x\C-r":re-read-init-file}.
1070 Options, if supplied, have the following meanings:
1074 Use @var{keymap} as the keymap to be affected by
1075 the subsequent bindings. Acceptable @var{keymap}
1078 @code{emacs-standard},
1083 @code{vi-command}, and
1085 @code{vi} is equivalent to @code{vi-command};
1086 @code{emacs} is equivalent to @code{emacs-standard}.
1089 List the names of all readline functions
1092 List current function names and bindings
1095 Dump function names and bindings in such a way that they can be re-read
1098 Read key bindings from @var{filename}
1101 Query about which keys invoke the named @var{function}
1106 command [-pVv] @var{command} [@var{args} ...]
1108 Runs @var{command} with @var{arg} ignoring shell functions. If
1109 you have a shell function called @code{ls}, and you wish to call
1110 the command @code{ls}, you can say @samp{command ls}. The
1111 @code{-p} option means to use a default value for @code{$PATH}
1112 that is guaranteed to find all of the standard utilities.
1114 If either the @code{-V} or @code{-v} option is supplied, a
1115 description of @var{command} is printed. The @code{-v} option
1116 causes a single word indicating the command or file name used to
1117 invoke @var{command} to be printed; the @code{-V} option produces
1118 a more verbose description.
1122 declare [-frxi] [@var{name}[=@var{value}]]
1125 Declare variables and/or give them attributes. If no @var{name}s
1126 are given, then display the values of variables instead.
1127 @code{-f} means to use function names only. @code{-r} says to
1128 make @var{name}s readonly. @code{-x} says to mark @var{name}s
1129 for export. @code{-i} says that the variable is to be treated as
1130 an integer; arithmetic evaluation (@pxref{Shell Arithmetic}) is
1131 performed when the variable is assigned a value. Using @code{+}
1132 instead of @code{-} turns off the attribute instead. When used in
1133 a function, @code{declare} makes @var{name}s local, as with the
1134 @code{local} command.
1138 enable [-n] [-a] [@var{name} ...]
1140 Enable and disable builtin shell commands. This allows you to
1141 use a disk command which has the same name as a shell builtin.
1142 If @code{-n} is used, the @var{name}s become disabled. Otherwise
1143 @var{name}s are enabled. For example, to use the @code{test} binary
1144 found via @code{$PATH} instead of the shell builtin version, type
1145 @samp{enable -n test}. The @code{-a} option means to list
1146 each builtin with an indication of whether or not it is enabled.
1150 help [@var{pattern}]
1152 Display helpful information about builtin commands. If
1153 @var{pattern} is specified, @code{help} gives detailed help
1154 on all commands matching @var{pattern}, otherwise a list of
1155 the builtins is printed.
1159 local @var{name}[=@var{value}]
1161 For each argument, create a local variable called @var{name}, and
1162 give it @var{value}.
1163 @code{local} can only be used within a function; it makes the variable
1164 @var{name} have a visible scope restricted to that function and its
1169 type [-all] [-type | -path] [@var{name} ...]
1171 For each @var{name}, indicate how it would be interpreted if used as a
1174 If the @code{-type} flag is used, @code{type} returns a single word
1175 which is one of ``alias'', ``function'', ``builtin'', ``file'' or
1176 ``keyword'', if @var{name} is an alias, shell function, shell builtin,
1177 disk file, or shell reserved word, respectively.
1179 If the @code{-path} flag is used, @code{type} either returns the name
1180 of the disk file that would be executed, or nothing if @code{-type}
1181 would not return ``file''.
1183 If the @code{-all} flag is used, returns all of the places that contain
1184 an executable named @var{file}. This includes aliases and functions,
1185 if and only if the @code{-path} flag is not also used.
1187 @code{Type} accepts @code{-a}, @code{-t}, and @code{-p} as equivalent to
1188 @code{-all}, @code{-type}, and @code{-path}, respectively.
1192 ulimit [-acdmstfpnuvSH] [@var{limit}]
1194 @code{Ulimit} provides control over the resources available to processes
1195 started by the shell, on systems that allow such control. If an
1196 option is given, it is interpreted as follows:
1199 change and report the soft limit associated with a resource (the
1200 default if the @code{-H} option is not given).
1202 change and report the hard limit associated with a resource.
1204 all current limits are reported.
1207 the maximum size of core files created.
1210 the maximum size of a process's data segment.
1213 the maximum resident set size.
1216 the maximum stack size.
1219 the maximum amount of cpu time in seconds.
1222 the maximum size of files created by the shell.
1225 the pipe buffer size.
1228 the maximum number of open file descriptors.
1231 the maximum number of processes available to a single user.
1234 the maximum amount of virtual memory available to the process.
1238 If @var{limit} is given, it is the new value of the specified resource.
1239 Otherwise, the current value of the specified resource is printed. If
1240 no option is given, then @samp{-f} is assumed. Values are in 1024-byte
1241 increments, except for @samp{-t}, which is in seconds, @samp{-p},
1242 which is in units of 512-byte blocks, and @samp{-n} and @samp{-u}, which
1243 are unscaled values.
1247 @node The Set Builtin
1248 @section The Set Builtin
1250 This builtin is so overloaded that it deserves its own section.
1255 set [-abefhkmnptuvxldCHP] [-o @var{option}] [@var{argument} ...]
1260 Mark variables which are modified or created for export.
1263 Cause the status of terminated background jobs to be reported
1264 immediately, rather than before printing the next primary prompt.
1267 Exit immediately if a command exits with a non-zero status.
1270 Disable file name generation (globbing).
1273 Locate and remember (hash) commands as functions are defined, rather
1274 than when the function is executed.
1277 All keyword arguments are placed in the environment for a command, not
1278 just those that precede the command name.
1281 Job control is enabled (@pxref{Job Control}).
1284 Read commands but do not execute them.
1286 @item -o @var{option-name}
1288 Set the flag corresponding to @var{option-name}:
1295 the shell will perform brace expansion (@pxref{Brace Expansion}).
1298 use an emacs-style line editing interface (@pxref{Command Line Editing}).
1307 the shell will not exit upon reading EOF.
1309 @item interactive-comments
1310 allow a word beginning with a @samp{#} to cause that word and
1311 all remaining characters on that line to be ignored in an
1339 change the behavior of Bash where the default operation differs
1340 from the Posix 1003.2 standard to match the standard. This
1341 is intended to make Bash behave as a strict superset of that
1351 use a @code{vi}-style line editing interface.
1358 Turn on privileged mode.
1359 In this mode, the @code{$ENV}
1360 file is not processed, and shell functions
1361 are not inherited from the environment. This is enabled automatically
1362 on startup if the effective user (group) id is not equal to the real
1363 user (group) id. Turning this option off causes the effective user
1364 and group ids to be set to the real user and group ids.
1367 Exit after reading and executing one command.
1370 Treat unset variables as an error when substituting.
1373 Print shell input lines as they are read.
1376 Print commands and their arguments as they are executed.
1379 Save and restore the binding of the @var{name} in a @code{for} command.
1382 Disable the hashing of commands that are looked up for execution.
1383 Normally, commands are remembered in a hash table, and once found, do
1384 not have to be looked up again.
1387 Disallow output redirection to existing files.
1390 Enable ! style history substitution. This flag is on by default.
1393 If set, do not follow symbolic links when performing commands such as
1394 @code{cd} which change the current directory. The physical directory
1398 If no arguments follow this flag, then the positional parameters are
1399 unset. Otherwise, the positional parameters are set to the
1400 @var{arguments}, even if some of them begin with a @code{-}.
1403 Signal the end of options, cause all remaining @var{arguments}
1404 to be assigned to the positional parameters. The @code{-x}
1405 and @code{-v} options are turned off.
1406 If there are no arguments, the positional parameters remain unchanged.
1409 Using @samp{+} rather than @samp{-} causes these flags to be
1410 turned off. The flags can also be used upon invocation of the
1411 shell. The current set of flags may be found in @code{$-}. The
1412 remaining N @var{arguments} are positional parameters and are
1413 assigned, in order, to @code{$1}, @code{$2}, .. @code{$N}. If
1414 no arguments are given, all shell variables are printed.
1417 @node Bash Variables
1418 @section Bash Variables
1420 These variables are set or used by bash, but other shells
1421 do not normally treat them specially.
1426 @itemx history_control
1427 Set to a value of @samp{ignorespace}, it means don't enter lines which
1428 begin with a space or tab into the history list. Set to a value
1429 of @samp{ignoredups}, it means don't enter lines which match the last
1430 entered line. A value of @samp{ignoreboth} combines the two options.
1431 Unset, or set to any other value than those above, means to save
1432 all lines on the history list.
1435 The name of the file to which the command history is saved.
1438 If set, this is the maximum number of commands to remember in the
1442 Up to three characters which control history expansion, quick
1443 substitution, and tokenization (@pxref{History Interaction}).
1444 The first character is the
1445 @dfn{history-expansion-char}, that is, the character which signifies the
1446 start of a history expansion, normally @samp{!}. The second character is the
1447 character which signifies `quick substitution' when seen as the first
1448 character on a line, normally @samp{^}. The optional third character is the
1449 character which signifies the remainder of the line is a comment, when
1450 found as the first character of a word, usually @samp{#}. The history
1451 comment character causes history substitution to be skipped for the
1452 remaining words on the line. It does not necessarily cause the shell
1453 parser to treat the rest of the line as a comment.
1456 The history number, or index in the history list, of the current
1457 command. If @code{HISTCMD} is unset, it loses its special properties,
1458 even if it is subsequently reset.
1460 @item hostname_completion_file
1462 Contains the name of a file in the same format as @file{/etc/hosts} that
1463 should be read when the shell needs to complete a hostname. You can
1464 change the file interactively; the next time you attempt to complete a
1465 hostname, Bash will add the contents of the new file to the already
1469 How often (in seconds) that the shell should check for mail
1470 in the files specified in @code{MAILPATH}.
1472 @item PROMPT_COMMAND
1473 If present, this contains a string which is a command to execute
1474 before the printing of each primary prompt (@code{$PS1}).
1477 The numeric real user id of the current user.
1480 The numeric effective user id of the current user.
1483 A string describing the machine Bash is running on.
1486 A string describing the operating system Bash is running on.
1489 A colon-separated list of suffixes to ignore when performing
1491 A file name whose suffix matches one of the entries in
1493 is excluded from the list of matched file names. A sample
1494 value is @samp{.o:~}
1497 The name of the Readline startup file, overriding the default
1498 of @file{~/.inputrc}.
1501 The version number of the current instance of Bash.
1504 Controls the action of the shell on receipt of an @code{EOF} character
1505 as the sole input. If set, then the value of it is the number
1506 of consecutive @code{EOF} characters that can be read as the
1507 first characters on an input line
1508 before the shell will exit. If the variable exists but does not
1509 have a numeric value (or has no value) then the default is 10.
1510 If the variable does not exist, then @code{EOF} signifies the end of
1511 input to the shell. This is only in effect for interactive shells.
1513 @item no_exit_on_failed_exec
1514 If this variable exists, the shell will not exit in the case that it
1515 couldn't execute the file specified in the @code{exec} command.
1518 If present, says not to follow symbolic links when doing commands
1519 that change the current working directory. By default, bash follows
1520 the logical chain of directories when performing commands such as
1521 @code{cd} which change the current directory.
1523 For example, if @file{/usr/sys} is a link to @file{/usr/local/sys} then:
1525 $ cd /usr/sys; echo $PWD
1532 If @code{nolinks} exists, then:
1534 $ cd /usr/sys; echo $PWD
1540 See also the description of the @code{-P} option to the @code{set}
1541 builtin, @ref{The Set Builtin}.
1544 @node Shell Arithmetic
1545 @section Shell Arithmetic
1548 * Arithmetic Evaluation:: How shell arithmetic works.
1549 * Arithmetic Expansion:: How to use arithmetic in shell expansions.
1550 * Arithmetic Builtins:: Builtin commands that use shell arithmetic.
1553 @node Arithmetic Evaluation
1554 @subsection Arithmetic Evaluation
1556 The shell allows arithmetic expressions to be evaluated, as one of
1557 the shell expansions or by the @code{let} builtin.
1559 Evaluation is done in long integers with no check for overflow,
1560 though division by 0 is trapped and flagged as an error. The
1561 following list of operators is grouped into levels of
1562 equal-precedence operators. The levels are listed in order of
1563 decreasing precedence.
1567 unary minus and plus
1570 logical and bitwise negation
1573 multiplication, division, remainder
1576 addition, subtraction
1579 left and right bitwise shifts
1585 equality and inequality
1591 bitwise exclusive OR
1602 @item = *= /= %= += -= <<= >>= &= ^= |=
1606 Shell variables are allowed as operands; parameter expansion is
1607 performed before the expression is evaluated.
1608 The value of a parameter is coerced to a long integer within
1609 an expression. A shell variable need not have its integer attribute
1610 turned on to be used in an expression.
1612 Constants with a leading 0 are interpreted as octal numbers.
1613 A leading @code{0x} or @code{0X} denotes hexadecimal. Otherwise,
1614 numbers take the form [@var{base#}]n, where @var{base} is a
1615 decimal number between 2 and 36 representing the arithmetic
1616 base, and @var{n} is a number in that base. If @var{base} is
1617 omitted, then base 10 is used.
1619 Operators are evaluated in order of precedence. Sub-expressions in
1620 parentheses are evaluated first and may override the precedence
1623 @node Arithmetic Expansion
1624 @subsection Arithmetic Expansion
1626 Arithmetic expansion allows the evaluation of an arithmetic expression
1627 and the substitution of the result. There are two formats for
1628 arithmetic expansion:
1635 The expression is treated as if it were within double quotes, but
1636 a double quote inside the braces or parentheses is not treated
1637 specially. All tokens in the expression undergo parameter
1638 expansion, command substitution, and quote removal. Arithmetic
1639 substitutions may be nested.
1641 The evaluation is performed according to the rules listed above.
1642 If the expression is invalid, Bash
1643 prints a message indicating failure and no substitution occurs.
1645 @node Arithmetic Builtins
1646 @subsection Arithmetic Builtins
1651 let @var{expression} [@var{expression}]
1653 The @code{let} builtin allows arithmetic to be performed on shell
1654 variables. Each @var{expression} is evaluated according to the
1655 rules given previously (@pxref{Arithmetic Evaluation}). If the
1656 last @var{expression} evaluates to 0, @code{let} returns 1;
1657 otherwise 0 is returned.
1660 @node Printing a Prompt
1661 @section Controlling the Prompt
1663 The value of the variable @code{$PROMPT_COMMAND} is examined just before
1664 Bash prints each primary prompt. If it is set and non-null, then the
1665 value is executed just as if you had typed it on the command line.
1667 In addition, the following table describes the special characters which
1668 can appear in the @code{PS1} variable:
1672 the time, in HH:MM:SS format.
1674 the date, in "Weekday Month Date" format (e.g. "Tue May 26").
1678 the name of the shell, the basename of @code{$0} (the portion
1679 following the final slash).
1681 the current working directory.
1683 the basename of @code{$PWD}.
1689 the command number of this command.
1691 the history number of this command.
1693 the character corresponding to the octal number @code{nnn}.
1695 if the effective uid is 0, @code{#}, otherwise @code{$}.
1699 begin a sequence of non-printing characters. This could be used to
1700 embed a terminal control sequence into the prompt.
1702 end a sequence of non-printing characters.
1706 @chapter Job Control
1708 This chapter disusses what job control is, how it works, and how
1709 Bash allows you to access its facilities.
1712 * Job Control Basics:: How job control works.
1713 * Job Control Builtins:: Bash builtin commands used to interact
1715 * Job Control Variables:: Variables Bash uses to customize job
1719 @node Job Control Basics
1720 @section Job Control Basics
1723 refers to the ability to selectively stop (suspend)
1724 the execution of processes and continue (resume)
1725 their execution at a later point. A user typically employs
1726 this facility via an interactive interface supplied jointly
1727 by the system's terminal driver and Bash.
1729 The shell associates a @var{job} with each pipeline. It keeps a
1730 table of currently executing jobs, which may be listed with the
1731 @code{jobs} command. When Bash starts a job
1732 asynchronously (in the background), it prints a line that looks
1737 indicating that this job is job number 1 and that the process ID
1738 of the last process in the pipeline associated with this job is
1739 25647. All of the processes in a single pipeline are members of
1740 the same job. Bash uses the @var{job} abstraction as the
1741 basis for job control.
1743 To facilitate the implementation of the user interface to job
1744 control, the system maintains the notion of a current terminal
1745 process group ID. Members of this process group (processes whose
1746 process group ID is equal to the current terminal process group
1747 ID) receive keyboard-generated signals such as @code{SIGINT}.
1748 These processes are said to be in the foreground. Background
1749 processes are those whose process group ID differs from the
1750 terminal's; such processes are immune to keyboard-generated
1751 signals. Only foreground processes are allowed to read from or
1752 write to the terminal. Background processes which attempt to
1753 read from (write to) the terminal are sent a @code{SIGTTIN}
1754 (@code{SIGTTOU}) signal by the terminal driver, which, unless
1755 caught, suspends the process.
1757 If the operating system on which Bash is running supports
1758 job control, Bash allows you to use it. Typing the
1759 @var{suspend} character (typically @samp{^Z}, Control-Z) while a
1760 process is running causes that process to be stopped and returns
1761 you to Bash. Typing the @var{delayed suspend} character
1762 (typically @samp{^Y}, Control-Y) causes the process to be stopped
1763 when it attempts to read input from the terminal, and control to
1764 be returned to Bash. You may then manipulate the state of
1765 this job, using the @code{bg} command to continue it in the
1766 background, the @code{fg} command to continue it in the
1767 foreground, or the @code{kill} command to kill it. A @samp{^Z}
1768 takes effect immediately, and has the additional side effect of
1769 causing pending output and typeahead to be discarded.
1771 There are a number of ways to refer to a job in the shell. The
1772 character @samp{%} introduces a job name. Job number @code{n}
1773 may be referred to as @samp{%n}. A job may also be referred to
1774 using a prefix of the name used to start it, or using a substring
1775 that appears in its command line. For example, @samp{%ce} refers
1776 to a stopped @code{ce} job. Using @samp{%?ce}, on the
1777 other hand, refers to any job containing the string @samp{ce} in
1778 its command line. If the prefix or substring matches more than one job,
1779 Bash reports an error. The symbols @samp{%%} and
1780 @samp{%+} refer to the shell's notion of the current job, which
1781 is the last job stopped while it was in the foreground. The
1782 previous job may be referenced using @samp{%-}. In output
1783 pertaining to jobs (e.g., the output of the @code{jobs} command),
1784 the current job is always flagged with a @samp{+}, and the
1785 previous job with a @samp{-}.
1787 Simply naming a job can be used to bring it into the foreground:
1788 @samp{%1} is a synonym for @samp{fg %1} bringing job 1 from the
1789 background into the foreground. Similarly, @samp{%1 &} resumes
1790 job 1 in the background, equivalent to @samp{bg %1}
1792 The shell learns immediately whenever a job changes state.
1793 Normally, Bash waits until it is about to print a prompt
1794 before reporting changes in a job's status so as to not interrupt
1795 any other output. If the
1796 the @code{-b} option to the @code{set} builtin is set,
1797 Bash reports such changes immediately (@pxref{The Set Builtin}).
1798 This feature is also controlled by the variable @code{notify}.
1800 If you attempt to exit bash while jobs are stopped, the
1801 shell prints a message warning you. You may then use the
1802 @code{jobs} command to inspect their status. If you do this, or
1803 try to exit again immediately, you are not warned again, and the
1804 stopped jobs are terminated.
1806 @node Job Control Builtins
1807 @section Job Control Builtins
1815 Place @var{jobspec} into the background, as if it had been started
1816 with @samp{&}. If @var{jobspec} is not supplied, the current job
1823 Bring @var{jobspec} into the foreground and make it the current job.
1824 If @var{jobspec} is not supplied, the current job is used.
1828 jobs [-lpn] [@var{jobspec}]
1829 jobs -x @var{command} [@var{jobspec}]
1832 The first form lists the active jobs. The @code{-l} option lists
1833 process IDs in addition to the normal information; the @code{-p}
1834 option lists only the process ID of the job's process group
1835 leader. The @code{-n} option displays only jobs that have
1836 changed status since last notfied. If @var{jobspec} is given,
1837 output is restricted to information about that job.
1838 If @var{jobspec} is not supplied, the status of all jobs is
1841 If the @code{-x} option is supplied, @code{jobs} replaces any
1842 @var{jobspec} found in @var{command} or @var{arguments} with the
1843 corresponding process group ID, and executes @var{command},
1844 passing it @var{argument}s, returning its exit status.
1850 Suspend the execution of this shell until it receives a
1851 @code{SIGCONT} signal. The @code{-f} option means to suspend
1852 even if the shell is a login shell.
1856 When job control is active, the @code{kill} and @code{wait}
1857 builtins also accept @var{jobspec} arguments.
1859 @node Job Control Variables
1860 @section Job Control Variables
1865 This variable controls how the shell interacts with the user and
1866 job control. If this variable exists then single word simple
1867 commands without redirects are treated as candidates for resumption
1868 of an existing job. There is no ambiguity allowed; if you have
1869 more than one job beginning with the string that you have typed, then
1870 the most recently accessed job will be selected.
1871 The name of a stopped job, in this context, is the command line
1872 used to start it. If this variable is set to the value @code{exact},
1873 the string supplied must match the name of a stopped job exactly;
1874 if set to @code{substring},
1875 the string supplied needs to match a substring of the name of a
1876 stopped job. The @code{substring} value provides functionality
1877 analogous to the @code{%?} job id (@pxref{Job Control Basics}).
1878 If set to any other value, the supplied string must
1879 be a prefix of a stopped job's name; this provides functionality
1880 analogous to the @code{%} job id.
1883 Setting this variable to a value is equivalent to
1884 @samp{set -b}; unsetting it is equivalent to @samp{set +b}
1885 (@pxref{The Set Builtin}).
1889 @set readline-appendix
1890 @set history-appendix
1891 @cindex History, how to use
1892 @include hsuser.texinfo
1893 @cindex Readline, how to use
1894 @include rluser.texinfo
1895 @clear readline-appendix
1896 @clear history-appendix
1898 @node Variable Index
1899 @appendix Variable Index
1903 @appendix Concept Index