Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
bash(1)
Edit
PageHistory
Diff
Info
LikePages
!!BASH __Navigation__%%% 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: __bash(____1)__ - (this page) * __NAME__ * __SYNOPSIS__ * __COPYRIGHT__ * __DESCRIPTION__ * __OPTIONS__ * __ARGUMENTS__ * __INVOCATION__ [bash(1)Part2] * DEFINITIONS * RESERVED WORDS * SHELL GRAMMAR * COMMENTS * QUOTING [bash(1)Part3] * PARAMETERS [bash(1)Part4] * EXPANSION [bash(1)Part5] * REDIRECTION * ALIASES * FUNCTIONS * ARITHMETIC EVALUATION * CONDITIONAL EXPRESSIONS * SIMPLE COMMAND EXPANSION * COMMAND EXECUTION * COMMAND EXECUTION ENVIRONMENT * ENVIRONMENT * EXIT STATUS * SIGNALS * JOB CONTROL * PROMPTING [bash(1)Part6] * READLINE * HISTORY * HISTORY EXPANSION [bash(1)Part7] * SHELL BUILTIN COMMANDS * RESTRICTED SHELL * SEE ALSO * FILES * AUTHORS * BUG REPORTS * BUGS ---- !!NAME bash - GNU Bourne-Again SHell !!SYNOPSIS __bash__ [[options] [[file] !!COPYRIGHT Bash is Copyright (C) 1989-2001 by the Free Software Foundation, Inc. !!DESCRIPTION __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__). __Bash__ is intended to be a conformant implementation of the [IEEE] [POSIX] [Shell] and Tools specification (IEEE Working Group 1003.2). !!OPTIONS 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: ;__-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__ . ;__-r__ : If the __-r__ option is present, the shell becomes ''restricted'' (see __RESTRICTED SHELL__ below). ;__-i__ : If the __-i__ option is present, the shell is ''interactive'' . ;__-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. ;__-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. ;__-__ : 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 __-__. __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. ;__-dump-po-strings__ : Equivalent to __-D__, but the output is in the GNU ''gettext'' __po__ (portable object) file format. ;__-dump-strings__ : Equivalent to __-D__. ;__-help__ : Display a usage message on standard output and exit successfully. ;__-init-file__ ''file'': ;__-rcfile__ ''file'' : Execute commands from ''file'' instead of the standard personal initialization file ''~/.bashrc'' if the shell is interactive (see __INVOCATION__ below). ;__-login__ : Make __bash__ act as if it had been invoked as a login shell (see __INVOCATION__ below). ;__-noediting__ : Do not use the GNU __readline__ library to read command lines when the shell is interactive. ;__-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). ;__-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__ . ;__-posix__ : Change the behavior of __bash__ where the default operation differs from the [POSIX] 1003.2 standard to match the standard (''posix mode''). ;__-restricted__ : The shell becomes restricted (see __RESTRICTED SHELL__ below). ;__-verbose__ : Equivalent to __-v__. ;__-version__ : Show version information for this instance of __bash__ on the standard output and exit successfully. !!ARGUMENTS 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. !!INVOCATION A ''login shell'' is one whose first character of argument zero is a __-__ , or one started with the __-login__ option. 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. 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. 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. When a login shell exits, __bash__ reads and executes commands from the file ''~/.bash_logout'', if it exists. 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''. 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: if [[ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi but the value of the __PATH__ variable is not used to search for the file name. 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. 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. __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. 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.
34 pages link to
bash(1)
:
bash(1)Part7
bash(1)Part6
bash(1)Part4
bash(1)Part3
TabCompletion
bash(1)Part2
Man1b
WindowsCommandLine
sh(1)
bash(1)Part5
DynamicTyping
POSIXLY_CORRECT
builtins(1)
environ(7)
CommonErrors
ulimit(1)
UnixWay
EnvironmentVariable
ulimit(3)
Shell
MeetingTopics.2002
GeoffCant
BourneShell
getopt(1)
SIGWINCH
ReligiousWar
BuildTools
TextEditor
rbash(1)
BashNotes
zsh(1)
GerwinVanDeSteeg
NewUserTips
PastMeetingIdeas
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.