Katana VentraIP

Bash (Unix shell)

Bash, short for Bourne-Again SHell, is a shell program and command language supported by the Free Software Foundation[2] and first developed for the GNU Project[3] by Brian Fox.[4] Designed as a 100%[5] free software alternative for the Bourne shell,[6][7][8] it was initially released in 1989.[9] Its moniker is a play on words, referencing both its predecessor, the Bourne shell,[10] and the concept of rebirth.[11][12]

Original author(s)

Chet Ramey

8 June 1989 (8 June 1989)

5.2.21[1] Edit this on Wikidata / 9 November 2023

C

Multilingual (gettext)

Since 4.0: GPL-3.0-or-later,
1.11? to 3.2: GPL-2.0-or-later,
0.99? to 1.05?: GPL-1.0-or-later

Since its inception, Bash has gained widespread adoption and is commonly used as the default login shell for numerous Linux distributions. It holds historical significance as one of the earliest programs ported to Linux by Linus Torvalds, alongside the GNU Compiler (GCC).[13] It is available on nearly all modern operating systems, making it a versatile tool in various computing environments.


As a command processor, Bash operates within a text window where users input commands to execute various tasks. It also supports the execution of commands from files, known as shell scripts, facilitating automation. In keeping with Unix shell conventions, Bash incorporates a rich set of features. The keywords, syntax, dynamically scoped variables and other basic features of the language are all copied from the Bourne shell (`sh`). Other features, e.g., history, are copied from the C shell (`csh`) and the Korn Shell (`ksh`). Bash is a POSIX-compliant shell, but with a number of extensions.

History[edit]

While bash is considered Unix-like,[14] it's also available on MacOS, Windows, BeOS,[15][16] and Haiku.[17]


Brian Fox began coding Bash on January 10, 1988,[18] after Richard Stallman became dissatisfied with the lack of progress being made by a prior developer.[7] Stallman and the FSF considered a free shell that could run existing shell scripts so strategic to a completely free system built from BSD and GNU code that this was one of the few projects they funded themselves, with Fox undertaking the work as an employee of FSF.[7][19] Fox released Bash as a beta, version .99, on June 8, 1989,[9] and remained the primary maintainer until sometime between mid-1992[20] and mid-1994,[21] when he was laid off from FSF[22] and his responsibility was transitioned to another early contributor, Chet Ramey.[23][24][25][26][27]


Since then, Bash has become by far the most popular shell among users of Linux, becoming the default interactive shell on that operating system's various distributions[28][29] and on Apple's macOS releases before Catalina in October 2019.[30][31][32] Bash has also been ported to Microsoft Windows[33][34] and distributed with Cygwin and MinGW, to DOS by the DJGPP project, to Novell NetWare, to OpenVMS by the GNU project,[35] to ArcaOS,[36] and to Android via various terminal emulation applications.


In September 2014, Stéphane Chazelas, a Unix/Linux specialist,[37] discovered a security bug in the program. The bug, first disclosed on September 24, was named Shellshock and assigned the numbers CVE-2014-6271, CVE-2014-6277 and CVE-2014-7169. The bug was regarded as severe, since CGI scripts using Bash could be vulnerable, enabling arbitrary code execution. The bug was related to how Bash passes function definitions to subshells through environment variables.[38]

and non-interactive invocation

Interactive

shell

jobs / job control and tab completion in interactive mode

Command history

A built-in "help" command, a , and an info page

man page

Shell and portability (i.e., POSIX) modes

compatibility

for condition-testing and iteration

Control structures

-style pipelines

UNIX

Configurable execution environment(s)

[39]

Command line

Quoting

Command name lookup, including "," "functions," shell built-ins and shell keywords

aliases

of inputs, outputs and error data streams, including "here documents" and "here strings"

Redirections

Subshells

codes

Exit status

as a means of inter-process communication

Signaling

Asynchronous execution

ANSI-C quoting

Brace and tilde expansions

Configurable and command line editing with GNU readline in interactive mode

prompt

Shell and startup files (dotfiles) such as '~/.bashrc'

session

Various settings and shell options with the 'set' and 'shopt'

built-ins

Execution traces ("xtrace"): lightweight for debugging purposes

logging

Vulnerabilities[edit]

A security hole in Bash dating from version 1.03 (August 1989),[86] dubbed Shellshock, was discovered in early September 2014 and quickly led to a range of attacks across the Internet.[87][88][89] Patches to fix the bugs were made available soon after the bugs were identified.

Licensing[edit]

Since 4.0: GPL-3.0-or-later [90]


1.11? to 3.2: GPL-2.0-or-later [91]


0.99? to 1.05?: GPL-1.0-or-later [92] [51] [93]

Comparison of command shells

Stephenson, Neal (2003). . HarperCollins. ISBN 978-0380815937.

In the Beginning... Was the Command Line

. ibm.com. Retrieved 19 May 2024.

"Evolution of shells in Linux"

. berkeley.edu. Retrieved 19 May 2024.

"Scripting Reference :: Scripting with the Bourne-Again Shell (Bash)"

. berkeley.edu. Retrieved 19 May 2024.

"IRIS :: Instructional & Research Information Systems :: FAQ: Unix :: About UNIX Shells"