Penguin
Annotated edit history of bash(1) version 2, including all changes. View license author blame.
Rev Author # Line
2 JohnMcPherson 1 !!BASH
1 perry 2
2 JohnMcPherson 3 __Navigation__%%%
4 Because this man page is so large that is causes trouble for both our web server and web browsers, it has been split into 7 pages:
1 perry 5
2 JohnMcPherson 6 __bash(____1)__ - (this page)
7 * __NAME__
8 * __SYNOPSIS__
9 * __COPYRIGHT__
10 * __DESCRIPTION__
11 * __OPTIONS__
12 * __ARGUMENTS__
13 * __INVOCATION__
1 perry 14
2 JohnMcPherson 15 [bash(1)Part2]
16 * DEFINITIONS
17 * RESERVED WORDS
18 * SHELL GRAMMAR
19 * COMMENTS
20 * QUOTING
1 perry 21
2 JohnMcPherson 22 [bash(1)Part3]
23 * PARAMETERS
1 perry 24
2 JohnMcPherson 25 [bash(1)Part4]
26 * EXPANSION
1 perry 27
2 JohnMcPherson 28 [bash(1)Part5]
29 * REDIRECTION
30 * ALIASES
31 * FUNCTIONS
32 * ARITHMETIC EVALUATION
33 * CONDITIONAL EXPRESSIONS
34 * SIMPLE COMMAND EXPANSION
35 * COMMAND EXECUTION
36 * COMMAND EXECUTION ENVIRONMENT
37 * ENVIRONMENT
38 * EXIT STATUS
39 * SIGNALS
40 * JOB CONTROL
41 * PROMPTING
1 perry 42
2 JohnMcPherson 43 [bash(1)Part6]
44 * READLINE
45 * HISTORY
46 * HISTORY EXPANSION
1 perry 47
48
2 JohnMcPherson 49 [bash(1)Part7]
50 * SHELL BUILTIN COMMANDS
51 * RESTRICTED SHELL
52 * SEE ALSO
53 * FILES
54 * AUTHORS
55 * BUG REPORTS
56 * BUGS
1 perry 57
2 JohnMcPherson 58 ----
1 perry 59
2 JohnMcPherson 60 !!NAME
61 bash - GNU Bourne-Again SHell
1 perry 62
2 JohnMcPherson 63 !!SYNOPSIS
64 __bash__ [[options] [[file]
1 perry 65
2 JohnMcPherson 66 !!COPYRIGHT
1 perry 67
2 JohnMcPherson 68 Bash is Copyright (C) 1989-2001 by the Free Software Foundation, Inc.
1 perry 69
2 JohnMcPherson 70 !!DESCRIPTION
71 __Bash__ is an __sh__-compatible command language interpreter that executes commands read from the standard input or from a file. __Bash__ also incorporates useful features from the ''Korn'' and ''C'' shells (__ksh__ and __csh__).
1 perry 72
2 JohnMcPherson 73 __Bash__ is intended to be a conformant implementation of the [IEEE] [POSIX] [Shell] and Tools specification (IEEE Working Group 1003.2).
1 perry 74
2 JohnMcPherson 75 !!OPTIONS
76 In addition to the single-character shell options documented in the description of the __set__ builtin command, __bash__ interprets the following options when it is invoked:
1 perry 77
78
79
80
2 JohnMcPherson 81 ;__-c__ '' string'' : If the __-c__ option is present, then commands are read from ''string'' . If there are arguments after the ''string'' , they are assigned to the positional parameters, starting with __$0__ .
82 ;__-r__ : If the __-r__ option is present, the shell becomes ''restricted'' (see __RESTRICTED SHELL__ below).
83 ;__-i__ : If the __-i__ option is present, the shell is ''interactive'' .
84 ;__-s__ : If the __-s__ option is present, or if no arguments remain after option processing, then commands are read from the standard input. This option allows the positional parameters to be set when invoking an interactive shell.
85 ;__-D__ : A list of all double-quoted strings preceded by __$__ is printed on the standard ouput. These are the strings that are subject to language translation when the current locale is not __C__ or [POSIX]. This implies the __-n__ option; no commands will be executed.
86 ;__-__ : A __-__ signals the end of options and disables further option processing. Any arguments after the __-__ are treated as filenames and arguments. An argument of __-__ is equivalent to __-__.
1 perry 87
88
89
2 JohnMcPherson 90 __Bash__ also interprets a number of multi-character options. These options must appear on the command line before the single-character options in order for them to be recognized.
1 perry 91
92
93
94
2 JohnMcPherson 95 ;__-dump-po-strings__ : Equivalent to __-D__, but the output is in the GNU ''gettext'' __po__ (portable object) file format.
96 ;__-dump-strings__ : Equivalent to __-D__.
97 ;__-help__ : Display a usage message on standard output and exit successfully.
98 ;__-init-file__ ''file'':
99 ;__-rcfile__ ''file'' :
1 perry 100
2 JohnMcPherson 101 Execute commands from ''file'' instead of the standard personal initialization file ''~/.bashrc'' if the shell is interactive (see __INVOCATION__ below).
102 ;__-login__ : Make __bash__ act as if it had been invoked as a login shell (see __INVOCATION__ below).
103 ;__-noediting__ : Do not use the GNU __readline__ library to read command lines when the shell is interactive.
104 ;__-noprofile__ : Do not read either the system-wide startup file /etc/profile or any of the personal initialization files ''~/.bash_profile'' , ''~/.bash_login'' , or ''~/.profile'' . By default, __bash__ reads these files when it is invoked as a login shell (see __INVOCATION__ below).
105 ;__-norc__ : Do not read and execute the personal initialization file ''~/.bashrc'' if the shell is interactive. This option is on by default if the shell is invoked as __sh__ .
106 ;__-posix__ : Change the behavior of __bash__ where the default operation differs from the [POSIX] 1003.2 standard to match the standard (''posix mode'').
107 ;__-restricted__ : The shell becomes restricted (see __RESTRICTED SHELL__ below).
108 ;__-verbose__ : Equivalent to __-v__.
109 ;__-version__ : Show version information for this instance of __bash__ on the standard output and exit successfully.
1 perry 110
111
112
113 !!ARGUMENTS
2 JohnMcPherson 114 If arguments remain after option processing, and neither the __-c__ nor the __-s__ option has been supplied, the first argument is assumed to be the name of a file containing shell commands. If __bash__ is invoked in this fashion, __$0__ is set to the name of the file, and the positional parameters are set to the remaining arguments. __Bash__ reads and executes commands from this file, then exits. __Bash__'s exit status is the exit status of the last command executed in the script. If no commands are executed, the exit status is 0.
1 perry 115
116 !!INVOCATION
2 JohnMcPherson 117 A ''login shell'' is one whose first character of argument zero is a __-__ , or one started with the __-login__ option.
1 perry 118
2 JohnMcPherson 119 An ''interactive'' shell is one started without non-option arguments and without the __-c__ option whose standard input and output are both connected to terminals (as determined by isatty(3)), or one started with the __-i__ option. __PS1__ is set and __$-__ includes __i__ if __bash__ is interactive, allowing a shell script or a startup file to test this state.
1 perry 120
2 JohnMcPherson 121 The following paragraphs describe how __bash__ executes its startup files. If any of the files exist but cannot be read, __bash__ reports an error. Tildes are expanded in file names as described below under __Tilde Expansion__ in the __EXPANSION__ section.
1 perry 122
2 JohnMcPherson 123 When __bash__ is invoked as an interactive login shell, or as a non-interactive shell with the __-login__ option, it first reads and executes commands from the file ''/etc/profile'', if that file exists. After reading that file, it looks for ''~/.bash_profile'', ''~/.bash_login'', and ''~/.profile'', in that order, and reads and executes commands from the first one that exists and is readable. The __-noprofile__ option may be used when the shell is started to inhibit this behavior.
1 perry 124
2 JohnMcPherson 125 When a login shell exits, __bash__ reads and executes commands from the file ''~/.bash_logout'', if it exists.
1 perry 126
2 JohnMcPherson 127 When an interactive shell that is not a login shell is started, __bash__ reads and executes commands from ''~/.bashrc'', if that file exists. This may be inhibited by using the __-norc__ option. The __-rcfile__ ''file'' option will force __bash__ to read and execute commands from ''file'' instead of ''~/.bashrc''.
1 perry 128
2 JohnMcPherson 129 When __bash__ is started non-interactively, to run a shell script, for example, it looks for the variable __BASH_ENV__ in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute. __Bash__ behaves as if the following command were executed:
1 perry 130
131
132
2 JohnMcPherson 133 if [[ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
1 perry 134
135
2 JohnMcPherson 136 but the value of the __PATH__ variable is not used to search for the file name.
1 perry 137
2 JohnMcPherson 138 If __bash__ is invoked with the name __sh__ , it tries to mimic the startup behavior of historical versions of __sh__ as closely as possible, while conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive shell with the __-login__ option, it first attempts to read and execute commands from ''/etc/profile'' and ''~/.profile'' , in that order. The __-noprofile__ option may be used to inhibit this behavior. When invoked as an interactive shell with the name __sh__ , __bash__ looks for the variable __ENV__ , expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as __sh__ does not attempt to read and execute commands from any other startup files, the __-rcfile__ option has no effect. A non-interactive shell invoked with the name __sh__ does not attempt to read any other startup files. When invoked as __sh__ , __bash__ enters ''posix'' mode after the startup files are read.
1 perry 139
2 JohnMcPherson 140 When __bash__ is started in ''posix'' mode, as with the __-posix__ command line option, it follows the [POSIX] standard for startup files. In this mode, interactive shells expand the __ENV__ variable and commands are read and executed from the file whose name is the expanded value. No other startup files are read.
1 perry 141
2 JohnMcPherson 142 __Bash__ attempts to determine when it is being run by the remote shell daemon, usually ''rshd''. If __bash__ determines it is being run by ''rshd'', it reads and executes commands from ''~/.bashrc'', if that file exists and is readable. It will not do this if invoked as __sh__. The __-norc__ option may be used to inhibit this behavior, and the __-rcfile__ option may be used to force another file to be read, but ''rshd'' does not generally invoke the shell with those options or allow them to be specified.
1 perry 143
2 JohnMcPherson 144 If the shell is started with the effective user (group) id not equal to the real user (group) id, and the __-p__ option is not supplied, no startup files are read, shell functions are not inherited from the environment, the __SHELLOPTS__ variable, if it appears in the environment, is ignored, and the effective user id is set to the real user id. If the __-p__ option is supplied at invocation, the startup behavior is the same, but the effective user id is not reset.
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 10 times)