Free Software or software libre is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also do these things and to prevent consumer-facing hardware... Unix shell
Unix shell
A Unix shell is a command-line interpreter and script host that provides a traditional user interface for the Unix operating system and for Unix-like systems.... written for the GNU Project
GNU Project
The GNU Project is a free software, mass collaboration project, announced on September 27 1983 by Richard Stallman. It initiated the GNU operating system, software development for which began in January 1984.... . Its name is an acronym which stands for Bourne-again shell. The name is a pun
Pun
A pun, or paronomasia, is a form of word play that deliberately exploits ambiguity between similar-sounding words for humour or rhetorical effect.... on the name of the Bourne shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Version 7 Unix, and replaced the Thompson shell, whose executable file had the same name, sh.... (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix
Version 7 Unix
Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system.... circa 1978, and the concept of being "born again". Bash was created in 1987 by Brian Fox
Brian Fox
Brian J. Fox is a computer programmer, entrepreneur, consultant, author, and open source advocate. In 1987, he authored the GNU Bash operating system shell, a common Unix operating system interface.... . In 1990 Chet Ramey
Chet Ramey
Chet Ramey is the current maintainer of the bash. He is a longtime employee of Case Western Reserve University, from which he also received his Bachelor of Science in Computer Engineering and Master's degree in Computer Science.... became the primary maintainer.
Bash is the default shell on most systems built on top of the Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by a family of Unix-like operating systems. The term Linux distribution is used to refer to the various operating systems that run on top of the Linux Kernel.... as well as on Mac OS X
Mac OS X
Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems.... and it can be run on most Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification.... operating systems. It has also been ported to Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces .... using Subsystem for UNIX-based Applications (SUA), or POSIX
POSIX
POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho... emulation provided by Cygwin
Cygwin
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment.... and MSYS
MinGW
MinGW , formerly mingw32, is a native porting of the GNU Compiler Collection to Microsoft Windows, along with a set of freely distributable import libraries and header files for the Windows API.... .
Free Software or software libre is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also do these things and to prevent consumer-facing hardware... Unix shell
Unix shell
A Unix shell is a command-line interpreter and script host that provides a traditional user interface for the Unix operating system and for Unix-like systems.... written for the GNU Project
GNU Project
The GNU Project is a free software, mass collaboration project, announced on September 27 1983 by Richard Stallman. It initiated the GNU operating system, software development for which began in January 1984.... . Its name is an acronym which stands for Bourne-again shell. The name is a pun
Pun
A pun, or paronomasia, is a form of word play that deliberately exploits ambiguity between similar-sounding words for humour or rhetorical effect.... on the name of the Bourne shell
Bourne shell
The Bourne shell, or sh, was the default Unix shell of Version 7 Unix, and replaced the Thompson shell, whose executable file had the same name, sh.... (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix
Version 7 Unix
Seventh Edition Unix, also called Version 7 Unix, Version 7 or just V7, was an important early release of the Unix operating system.... circa 1978, and the concept of being "born again". Bash was created in 1987 by Brian Fox
Brian Fox
Brian J. Fox is a computer programmer, entrepreneur, consultant, author, and open source advocate. In 1987, he authored the GNU Bash operating system shell, a common Unix operating system interface.... . In 1990 Chet Ramey
Chet Ramey
Chet Ramey is the current maintainer of the bash. He is a longtime employee of Case Western Reserve University, from which he also received his Bachelor of Science in Computer Engineering and Master's degree in Computer Science.... became the primary maintainer.
Bash is the default shell on most systems built on top of the Linux kernel
Linux kernel
The Linux kernel is an operating system kernel used by a family of Unix-like operating systems. The term Linux distribution is used to refer to the various operating systems that run on top of the Linux Kernel.... as well as on Mac OS X
Mac OS X
Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems.... and it can be run on most Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification.... operating systems. It has also been ported to Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces .... using Subsystem for UNIX-based Applications (SUA), or POSIX
POSIX
POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho... emulation provided by Cygwin
Cygwin
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment.... and MSYS
MinGW
MinGW , formerly mingw32, is a native porting of the GNU Compiler Collection to Microsoft Windows, along with a set of freely distributable import libraries and header files for the Windows API.... . It has been ported to MS-DOS
MS-DOS
MS-DOS is an operating system commercialized by Microsoft. It was the most commonly used member of the DOS family of operating systems and was the main operating system for personal computers during the 1980s.... by the DJGPP
DJGPP
DJGPP is a 32-bit C /C++/Objective C/Objective C/Ada /Fortran development suite for x86+ PC compatibles that runs under DOS or compatibles. It is guided by DJ Delorie, who started the project in 1989.... project and to Novell NetWare
Novell NetWare
NetWare is a network operating system developed by Novell, Inc. It initially used cooperative multitasking to run various services on a personal computer, and the network protocols were based on the archetypal Xerox Xerox Network Services Protocol stack.... .
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell .... syntax is a superset of the Bourne shell command syntax. The vast majority of Bourne shell scripts can be executed by Bash without modification, with the exception of Bourne shell scripts referencing a Bourne special variable or those using builtin
Shell builtin
In computing, a shell builtin is a Command or a Subroutine, called from a Shell , that is executed directly in the shell itself, instead of an external executable computer program which the shell would load and execute.... Bourne commands. Bash command syntax includes ideas drawn from the Korn shell
Korn shell
The Korn shell is a Unix shell which was developed by David Korn in the early 1980s. It is backwards-compatible with the Bourne shell and includes many features of the C shell as well, such as a command history, which was inspired by the requests of Bell Labs users.... (ksh) and the C shell
C shell
The C shell is a Unix shell developed by Bill Joy for the Berkeley Software Distribution Unix system. It was originally derived from the 6th Edition Unix /bin/sh , the predecessor of the Bourne shell.... (csh) such as command line editing, command history
Command History
Command history is a common feature in command line interpreter , computer algebra programs, and other Computer software that interacts with the user through a command line interface.... , the directory stack, the $RANDOM and $PPID variables, and POSIX
POSIX
POSIX or "Portable Operating System Interface" is the collective name of a family of related standardizations specified by the Institute of Electrical and Electronics Engineers to define the application programming interface , along with shell and utilities interfaces for software compatible with variants of the Unix operating system, altho... command substitution syntax $(…). When used as an interactive command shell and pressing the tab key
Tab key
Tab key on a alphanumeric keyboard is used to advance the cursor to the next tab stop.... , Bash automatically uses command line completion
Command line completion
Command line completion is a common feature of command line interpreters, in which the program automatically fills in partially typed commands.... to match partly typed program names, filenames and variable names.
Bash's syntax has many extensions which the Bourne shell lacks. Bash can perform integer calculations without spawning external processes, unlike the Bourne shell. Bash uses the ((…)) command and the $[…] variable syntax for this purpose. Bash syntax simplifies I/O redirection in ways that are not possible in the traditional Bourne shell. For example, Bash can redirect standard output
Standard streams
In Unix and Unix-like operating systems, as well as certain programming language interfaces, the standard streams are preconnected input and output channels between a computer program and its environment when it begins execution.... (stdout) and standard error
Standard streams
In Unix and Unix-like operating systems, as well as certain programming language interfaces, the standard streams are preconnected input and output channels between a computer program and its environment when it begins execution.... (stderr) at the same time using the &> operator. This is simpler to type than the Bourne shell equivalent 'command > file 2>&1'.
Bash supports here documents just as the Bourne shell always has. However, since version 2.05b Bash can redirect standard input
Standard streams
In Unix and Unix-like operating systems, as well as certain programming language interfaces, the standard streams are preconnected input and output channels between a computer program and its environment when it begins execution.... (stdin) from a "here string" using the <<< operator.
In computing, regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters.... matching using a syntax reminiscent of Perl
Perl
In computer programming, Perl is a high-level programming language, List of programming languages by category, Interpreter , dynamic programming language.... .
The C shell is a Unix shell developed by Bill Joy for the Berkeley Software Distribution Unix system. It was originally derived from the 6th Edition Unix /bin/sh , the predecessor of the Bourne shell.... , that allows arbitrary strings to be generated using a similar technique to filename expansion. However the generated names need not exist as files. The results of each expanded string are not sorted and left to right order is preserved:
This is a bash-specific feature
echo ae # ape ace ade abe
Brace expansions should not be used in portable shell scripts, because a traditional shell will not produce the same output:
A traditional shell does not produce the same output
echo ae # ae
Startup scripts
When Bash starts, it executes the commands in a variety of different scripts.
When Bash is invoked as an interactive login shell, 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.
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.
Portability
Shell scripts written with Bash-specific features (bashisms) will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with #!/bin/bash. This problem became particularly important when Ubuntu began to ship the Debian Almquist shell
Debian Almquist shell
Debian Almquist shell is a Unix shell, much smaller than bash but still aiming at POSIX-compliancy. It requires less disk space but is also less feature-rich.... (dash) as the default scripting shell in October 2006, causing a wide variety of scripts to fail.