Bash (Unix shell): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Blush30720 (talk | contribs)
Rewrite of "Documentation" section. Added paragraph on help summaries for shell builtins
Blush30720 (talk | contribs)
Move some more citations down from the info box into the new Licensing section.
 
(74 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Short description|GNU replacement for the Bourne shell}}
{{ Short description
| GNU replacement for the Bourne shell
{{Use mdy dates|date=March 2014}}
{{Infobox software
| name = Bash
| logo = Gnu-bash-logo.svg
| screenshot = Bash screenshot.png
| caption = Screenshot of a Bash session
| author = [[Brian Fox (computer programmer)|Brian Fox]]
| developer = Chet Ramey<ref name="computerworld-Hamilton-Ramey">{{cite news |last1=Hamilton |first1=Naomi |title=The A-Z of Programming Languages: BASH/Bourne-Again Shell |website=[[Computerworld]] |url=http://www.computerworld.com.au/article/222764/ |archive-url=https://web.archive.org/web/20161108230747/http://www.computerworld.com.au/article/222764/ |archive-date=8 November 2016 |access-date=1 March 2022 |date=2008-05-30 <!-- https://web.archive.org/web/20081205093826/http://www.computerworld.com.au/index.php/id;1591223321;pp;2;fp;16;fpid;1
-->}}</ref><ref name="tiswww.case.edu-Ramey-BASH">{{cite web |last1=Ramey |first1=Chet |title=The GNU Bourne-Again Shell |url=https://tiswww.case.edu/php/chet/bash/bashtop.html |website=Technology Infrastructure Services |publisher=[[Case Western Reserve University]] |access-date=1 March 2022 |date=2021-04-20}}</ref>
| released = {{start date and age|1989|06|08}}
| latest release version = {{wikidata|property|preferred|references|edit|Q189248|P348|P548=Q2804309}}
| latest release date = {{wikidata|qualifier|preferred|single|Q189248|P348|P548=Q2804309|P577}}
| latest preview version = {{wikidata|property|preferred|references|edit|Q189248|P348|P548=Q51930650}}
| latest preview date = {{wikidata|qualifier|preferred|single|Q189248|P348|P548=Q51930650|P577}}
| programming language = [[C (programming language)|C]]
| operating system = {{Plainlist|
* [[Unix-like]]<ref>{{cite web|url=ftp://ftp.cwru.edu/pub/bash/FAQ|archive-url=https://web.archive.org/web/20180901171316/ftp://ftp.cwru.edu/pub/bash/FAQ|archive-date=September 1, 2018|url-status=dead|title=Bash FAQ, version 4.14|access-date=April 9, 2016|df=mdy-all}}</ref>
* [[macOS]] ([[GNU General Public License#Version 2|GPL-2.0-or-later]]; GPL-3.0-or-later available through third parties)
* [[Windows]] ([[GNU General Public License#Version 3|GPL-3.0-or-later]])<ref>{{cite web|url=https://github.com/Microsoft/BashOnWindows/issues/107|title=Missing source code - GPL compliance? · Issue #107 · Microsoft/WSL|website=GitHub|access-date=July 8, 2016|archive-date=September 24, 2019|archive-url=https://web.archive.org/web/20190924163108/https://github.com/microsoft/WSL/issues/107|url-status=live}}</ref><ref>{{cite web|title=GNU Bash|url=http://www.softpedia.com/get/System/System-Miscellaneous/GNU-Bash.shtml|website=[[Softpedia]]|date=January 23, 2010|publisher=SoftNews|access-date=9 April 2016|archive-date=October 21, 2017|archive-url=https://web.archive.org/web/20171021004857/http://www.softpedia.com/get/System/System-Miscellaneous/GNU-Bash.shtml|url-status=live}}</ref>
* [[BeOS]],<ref name="forb">{{Cite web|url=https://www.forbes.com/1999/01/25/feat.html|title=A desktop alternative|website=Forbes}}</ref><ref>{{Cite web|url=http://testou.free.fr/www.beatjapan.org/mirror/www.be.com/documentation/user_docs/app_a_commandline.html|title=Appendix A: Using the BeOS Command Line Shell|website=testou.free.fr}}</ref> [[Haiku (operating system)|Haiku]]<ref>{{cite web | url=https://www.haiku-os.org/docs/userguide/en/applications/terminal.html | title=Terminal }}</ref>
}}
}}

| platform = [[GNU]]
{{ Use dmy dates
| language = Multilingual ([[gettext]])
| date = March 2014
| genre = [[Unix shell]], [[command language]]
| license = Since 4.0: [[GNU General Public License#Version 3|GPL-3.0-or-later]]<ref name="license">{{cite web | author = GNU Project | author-link = GNU Project | title = README file | url = https://www.gnu.org/software/bash/ | quote = Bash is free software, distributed under the terms of the [GNU] General Public License as published by the Free Software Foundation, version 3 of the License (or any later version). | access-date = April 16, 2014 | archive-date = April 26, 2019 | archive-url = https://web.archive.org/web/20190426210620/http://www.gnu.org/software/bash/ | url-status = live }}</ref><br />1.11? to 3.2: [[GNU General Public License#Version 2|GPL-2.0-or-later]]<ref>{{cite web|url=http://www.oldlinux.org/Linux.old/bin/old/bash-1.11/ |title=bash-1.11|website=oldlinux.org|quote=See test.c for GPL-2.0-or-later}}</ref><br />0.99? to 1.05?: [[GNU General Public License#Version 1|GPL-1.0-or-later]]<ref>{{cite web|url=http://www.oldlinux.org/Linux.old/bin/old/bash-1.05.tar |title=bash-1.05.tar|website=oldlinux.org}}</ref><ref name="bashfaq061">{{Cite web|title=BashFAQ/061 - Greg's Wiki|url=https://mywiki.wooledge.org/BashFAQ/061|access-date=2021-03-01|website=mywiki.wooledge.org|archive-date=March 2, 2021|archive-url=https://web.archive.org/web/20210302212811/https://mywiki.wooledge.org/BashFAQ/061|url-status=live}}</ref><ref>{{cite web|url=https://unix.stackexchange.com/questions/243375/is-there-a-way-to-download-the-presumably-initial-bash-source-bash-0-99 |title=Is there a way to download the presumably initial bash source bash-0.99?|website=unix.stackexchange.com}}</ref>
}}
}}


{{ Infobox software
'''Bash''' is a [[Unix shell]] and [[command language]] written by [[Brian Fox (computer programmer)|Brian Fox]] for the [[GNU Project]] as a [[free software]] replacement for the [[Bourne shell]].<ref name="GNUBSD">{{Cite newsgroup
| title = GNU + BSD = ?
| author =
[[ Brian Fox (programmer) | Brian Fox ]]
| author = [[Richard Stallman]] (forwarded with comments by Chet Ramey)
| date = February 10, 1988
| caption = Screenshot of a Bash session
| developer = Chet Ramey
| newsgroup = comp.unix.questions
| genre = [[Unix shell]], [[command language]]
| message-id = 2362@mandrill.CWRU.Edu
| language = Multilingual ([[gettext]])
| url = https://groups.google.com/g/comp.unix.questions/c/iNjWwkyroR8/m/yedr9yDWSuQJ
| latest preview date =
| access-date = December 28, 2021
{{ wikidata
| quote = For a year and a half, the GNU shell was "just about done". The author made repeated promises to deliver what he had done, and never kept them. Finally I could no longer believe he would ever deliver anything. So Foundation staff member Brian Fox is now implementing an imitation of the Bourne shell.
| qualifier | preferred | single
| archive-date = December 28, 2021
| Q189248 | P348 | P548 = Q51930650
| archive-url = https://web.archive.org/web/20211228023030/https://groups.google.com/g/comp.unix.questions/c/iNjWwkyroR8/m/yedr9yDWSuQJ
| url-status = live
| P577
}}
}}</ref><ref>{{Citation |last=Hamilton |first=Naomi |title=The A-Z of Programming Languages: BASH/Bourne-Again Shell |date=May 30, 2008 |journal=Computerworld |page=2 |url=http://www.computerworld.com.au/article/222764/a-z_programming_languages_bash_bourne-again_shell/?pp=2&fp=16&fpid=1 |access-date=March 21, 2011 |archive-url=https://web.archive.org/web/20110706103704/http://www.computerworld.com.au/article/222764/a-z_programming_languages_bash_bourne-again_shell/?pp=2&fp=16&fpid=1 |archive-date=July 6, 2011 |url-status=dead |quote=When Richard Stallman decided to create a full replacement for the then-encumbered Unix systems, he knew that he would eventually have to have replacements for all of the common utilities, especially the standard shell, and those replacements would have to have acceptable licensing.}} Original computerworld.com.au link is dead: see also copies of original material at [https://a-z.readthedocs.io/en/latest/bash.html readthedocs.io], [https://www2.computerworld.com.au/article/222764/a-z_programming_languages_bash_bourne-again_shell/ computerworld.com.au] and [https://cse.sc.edu/~mgv/csce330f16/pres/az.pdf the University of South Carolina].</ref> The shell's name is an acronym for ''Bourne-Again SHell'', a [[pun]] on the name of the Bourne shell that it replaces<ref>{{Cite web|title=I Almost Get a Linux Editor and Compiler|url=http://www.drdobbs.com/i-almost-get-a-linux-editor-and-compiler/184404693|access-date=2020-09-12|website=Dr. Dobb's|archive-date=March 2, 2021|archive-url=https://web.archive.org/web/20210302212410/https://www.drdobbs.com/i-almost-get-a-linux-editor-and-compiler/184404693|url-status=live}}</ref> and the notion of being "[[born again]]".<ref>
| latest preview version =
{{cite web
{{ wikidata
| author = [[Richard Stallman]]
| property | preferred | references
| title = About the GNU Project
| edit | Q189248 | P348
| publisher = [[Free Software Foundation]]
| P548 = Q51930650
| date = November 12, 2010
}}
| url = https://www.gnu.org/gnu/thegnuproject.html
| latest release date =
| quote = "Bourne Again Shell" is a play on the name ''Bourne Shell'', which was the usual shell on Unix.
{{ wikidata
| access-date = March 13, 2011
| qualifier | preferred | single
| archive-url= https://web.archive.org/web/20110424064815/https://www.gnu.org/gnu/thegnuproject.html| archive-date=April 24, 2011 | url-status= live}}
| Q189248 | P348 | P548 = Q2804309
</ref><ref>
| P577
{{Citation
}}
|last = Gattol
| latest release version =
|first = Markus
{{ wikidata
|title = Bourne-again Shell
|date = March 13, 2011
| property | preferred | references
| edit | Q189248 | P348
|url = http://www.markus-gattol.name/ws/bash.html
| P548 = Q2804309
|quote = The name is a pun on the name of the Bourne shell (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978, and the concept of being "born again".
}}
|access-date = March 13, 2011
| license = Since 4.0: [[GNU General Public License#Version 3|GPL-3.0-or-later]], <br />1.11? to 3.2: [[GNU General Public License#Version 2|GPL-2.0-or-later]], <br />0.99? to 1.05?: [[GNU General Public License#Version 1|GPL-1.0-or-later]]
|url-status = dead
| logo = Gnu-bash-logo.svg
|archive-url = https://web.archive.org/web/20110309092607/http://www.markus-gattol.name/ws/bash.html
| name = Bash
|archive-date = March 9, 2011
| operating system =
|df = mdy-all
{{ Plainlist |
* [[BeOS]],
* [[Haiku (operating system)|Haiku]],
* [[macOS]] ([[GNU General Public License#Version 2|GPL-2.0-or-later]]; GPL-3.0-or-later through 3rd parties),
* [[Unix-like]], and
* [[Windows]] ([[GNU General Public License#Version 3|GPL-3.0-or-later]])
}}
| platform = [[GNU]]
| programming language =
[[ C (programming language) | C ]]
| released =
{{ start date and age | 8 June 1989 }}
| screenshot = Bash screenshot.png
}}
}}
</ref> First released in 1989,<ref name=BashBeta>{{Cite newsgroup
| title = Bash is in beta release!
| author = Brian Fox (forwarded by Leonard H. Tower Jr.)
| date = June 8, 1989
| newsgroup = gnu.announce
| url = https://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=en
| access-date = October 28, 2010
| archive-date = May 4, 2013
| archive-url = https://web.archive.org/web/20130504075535/http://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=en
| url-status = live
}}</ref> it has been used as the default [[login]] shell for most [[Linux]] distributions and it was one of the first programs [[Linus Torvalds]] ported to Linux, alongside [[GNU Compiler Collection|GCC]].<ref name="groups.google.com">{{cite web|url = https://groups.google.com/group/comp.os.minix/msg/b813d52cbc5a044b|title = comp.os.minix|access-date = 2009-09-06|last = Torvalds|first = Linus Benedict|date=August 1991 | quote=I've currently ported bash(1.08) and gcc(1.40), and things seem to work.}}</ref> It is available on nearly all modern operating systems.


'''Bash''', short for ''Bourne-Again [[Shell (computing)|SHell]]'', is a [[Unix shell|shell program]] and [[command language]] supported by the [[Free Software Foundation|Free]] Software Foundation<ref>{{Cite web|url=https://www.fsf.org/|title=Front Page — Free Software Foundation — working together for free software|website=www.fsf.org}}</ref><ref>{{Cite web|url=https://www.gnu.org/software/software.html#mission-statement|title=Software- GNU Project - Free Software Foundation}}</ref> and first developed for the [[GNU Project|GNU]] Project by [[Brian Fox (programmer)|Brian Fox]].<ref>{{Cite web|url=https://www.gnu.org/software/bash/|title=Bash - GNU Project - Free Software Foundation}}</ref> Designed as a 100[[In the Beginning... Was the Command Line|%]] [[free software]] alternative for the [[Bourne shell]],<ref name="GNUBSD">{{Cite newsgroup |title=GNU + BSD = ? |author=[[Richard Stallman]] (forwarded with comments by Chet Ramey) |date=February 10, 1988 |newsgroup=comp.unix.questions |message-id=2362@mandrill.CWRU.Edu |url=https://groups.google.com/g/comp.unix.questions/c/iNjWwkyroR8/m/yedr9yDWSuQJ |access-date=December 28, 2021 |quote=For a year and a half, the GNU shell was "just about done". The author made repeated promises to deliver what he had done, and never kept them. Finally I could no longer believe he would ever deliver anything. So Foundation staff member Brian Fox is now implementing an imitation of the Bourne shell. |archive-date=December 28, 2021 |archive-url=https://web.archive.org/web/20211228023030/https://groups.google.com/g/comp.unix.questions/c/iNjWwkyroR8/m/yedr9yDWSuQJ |url-status=live}}</ref><ref>{{Citation |last=Hamilton |first=Naomi |title=The A-Z of Programming Languages: BASH/Bourne-Again Shell |date=May 30, 2008 |journal=Computerworld |page=2 |url=http://www.computerworld.com.au/article/222764/a-z_programming_languages_bash_bourne-again_shell/?pp=2&fp=16&fpid=1 |access-date=March 21, 2011 |archive-url=https://web.archive.org/web/20110706103704/http://www.computerworld.com.au/article/222764/a-z_programming_languages_bash_bourne-again_shell/?pp=2&fp=16&fpid=1 |archive-date=July 6, 2011 |url-status=dead |quote=When Richard Stallman decided to create a full replacement for the then-encumbered Unix systems, he knew that he would eventually have to have replacements for all of the common utilities, especially the standard shell, and those replacements would have to have acceptable licensing.}} Original computerworld.com.au link is dead: see also copies of original material at [https://a-z.readthedocs.io/en/latest/bash.html readthedocs.io], [https://www2.computerworld.com.au/article/222764/a-z_programming_languages_bash_bourne-again_shell/ computerworld.com.au] and [https://cse.sc.edu/~mgv/csce330f16/pres/az.pdf the University of South Carolina].</ref> it was initially released in 1989.<ref name="BashBeta">{{Cite newsgroup |title=Bash is in beta release! |author=Brian Fox (forwarded by Leonard H. Tower Jr.) |date=June 8, 1989 |newsgroup=gnu.announce |url=https://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=en |access-date=October 28, 2010 |archive-date=May 4, 2013 |archive-url=https://web.archive.org/web/20130504075535/http://groups.google.com/group/gnu.announce/msg/a509f48ffb298c35?hl=en |url-status=live}}</ref> Its moniker is a play on words, referencing both its predecessor, the Bourne shell,<ref>{{Cite web |title=I Almost Get a Linux Editor and Compiler |url=http://www.drdobbs.com/i-almost-get-a-linux-editor-and-compiler/184404693 |url-status=live |archive-url=https://web.archive.org/web/20210302212410/https://www.drdobbs.com/i-almost-get-a-linux-editor-and-compiler/184404693 |archive-date=March 2, 2021 |access-date=2020-09-12 |website=Dr. Dobb's}}</ref> and the concept of [[Born again|renewal]].<ref>
Bash is a [[Command-line interpreter|command processor]] that typically runs in a [[terminal emulator|text window]] where the user types commands that cause actions. Bash can also read and execute commands from a file, called a [[shell script]]. Like most Unix shells, it supports filename [[glob (programming)|globbing]] (wildcard matching), [[Pipeline (Unix)|piping]], [[here document]]s, [[command substitution]], [[Variable (programming)|variables]], and [[control flow|control structures]] for [[Conditional (programming)|condition-testing]] and [[iteration]]. The [[Keyword (computer programming)|keywords]], [[Syntax (programming languages)|syntax]], [[Scope (computer science)#Dynamic scoping|dynamically scoped]] variables and other basic features of the [[Language (computer science)|language]] are all copied from [[Bourne shell|sh]]. Other features, e.g., [[C shell#History|history]], are copied from [[C shell|csh]] and [[KornShell|ksh]]. Bash is a [[POSIX]]-compliant shell, but with a number of extensions.
{{cite web |author=[[Richard Stallman]] |date=November 12, 2010 |title=About the GNU Project |url=https://www.gnu.org/gnu/thegnuproject.html |url-status=live |archive-url=https://web.archive.org/web/20110424064815/https://www.gnu.org/gnu/thegnuproject.html |archive-date=April 24, 2011 |access-date=March 13, 2011 |publisher=[[Free Software Foundation]] |quote="Bourne Again Shell" is a play on the name ''Bourne Shell'', which was the usual shell on Unix.}}
</ref><ref>{{Citation |last=Gattol |first=Markus |title=Bourne-again Shell |date=March 13, 2011 |df=mdy-all |url=http://www.markus-gattol.name/ws/bash.html |access-date=March 13, 2011 |archive-url=https://web.archive.org/web/20110309092607/http://www.markus-gattol.name/ws/bash.html |archive-date=March 9, 2011 |url-status=dead |quote=The name is a pun on the name of the Bourne shell (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978, and the concept of being "born again".}}</ref>


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 GCC ([[GNU Compiler Collection]]).<ref name="groups.google.com">{{cite web |last=Torvalds |first=Linus Benedict |date=August 1991 |title=comp.os.minix |url=https://groups.google.com/group/comp.os.minix/msg/b813d52cbc5a044b |access-date=2009-09-06 |quote=I've currently ported bash(1.08) and gcc(1.40), and things seem to work.}}</ref> It is available on nearly all modern operating systems, making it a versatile tool in various computing environments.
A version is also available for [[Windows 10]] and [[Windows 11]] via the [[Windows Subsystem for Linux]].<ref>{{cite web |date=September 28, 2016 |title=How to install Bash shell command-line tool on Windows 10 |url=http://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 |url-status=live |archive-url=https://web.archive.org/web/20161120213017/http://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 |archive-date=November 20, 2016 |access-date=November 20, 2016}}</ref><ref>{{Cite web |last=Hoffman |first=Chris |date=July 30, 2021 |title=How to Install the Windows Subsystem for Linux on Windows 11 |url=https://www.howtogeek.com/744328/how-to-install-the-windows-subsystem-for-linux-on-windows-11/ |access-date=2022-10-12 |website=How-To Geek |language=en-US}}</ref> It is also the default user shell in [[Solaris (operating system)|Solaris]] 11.<ref>{{cite web |title=User Environment Feature Changes |url=https://docs.oracle.com/cd/E23824_01/html/E24456/userenv-1.html |url-status=live |archive-url=https://web.archive.org/web/20180612144748/https://docs.oracle.com/cd/E23824_01/html/E24456/userenv-1.html |archive-date=June 12, 2018 |access-date=June 8, 2018 |publisher=Oracle}}</ref> Bash was also the default shell in [[BeOS]],<ref name="forb" /> and in versions of [[MacOS|Apple macOS]] from 10.3 (originally, the default shell was [[tcsh]]) to 10.15 ([[macOS Catalina]]), which changed the default shell to [[zsh]],<ref name="zsh2" /> although Bash remains available as an alternative shell.<ref name=":0">{{Cite web |last=Hughes |first=Matthew |date=2019-06-04 |title=Why does macOS Catalina use Zsh instead of Bash? Licensing |url=https://thenextweb.com/dd/2019/06/04/why-does-macos-catalina-use-zsh-instead-of-bash-licensing/ |url-status=live |archive-url=https://web.archive.org/web/20201231231721/https://thenextweb.com/dd/2019/06/04/why-does-macos-catalina-use-zsh-instead-of-bash-licensing/ |archive-date=December 31, 2020 |access-date=2021-01-12 |website=The Next Web |language=en-us}}</ref>


As a [[Command-line interface|command processor]], Bash operates within a [[Terminal emulator|text window]] where users input commands to execute various tasks. It also supports the execution of commands from files, known as [[shell script]]s, facilitating [[automation]]. In keeping with [[Unix shell]] conventions, Bash incorporates a rich set of features. The [[Keyword (computer programming)|keywords]], [[Syntax (programming languages)|syntax]], [[Scope (computer science)#Dynamic scoping|dynamically scoped]] variables and other basic features of the [[formal language|language]] are all copied from [[Bourne shell|sh]]. Other features, e.g., [[C shell#History|history]], are copied from [[C shell|csh]] and [[KornShell|ksh]]. Bash is a [[POSIX]]-compliant shell, but with a number of extensions.
A [[Security bug|security hole]] in Bash dating from version 1.03 (August 1989),<ref name="Seclists-20141004">{{cite web |last=Chazelas |first=Stephane |title=oss-sec mailing list archives |url=http://seclists.org/oss-sec/2014/q4/102 |date=4 October 2014 |work=Seclists.org |access-date=4 October 2014 |archive-date=October 6, 2014 |archive-url=https://web.archive.org/web/20141006093452/http://seclists.org/oss-sec/2014/q4/102 |url-status=live }}</ref> dubbed [[Shellshock (software bug)|Shellshock]], was discovered in early September 2014 and quickly led to a range of [[Attack (computing)|attacks]] across the [[Internet]].<ref name="TR-20140924">{{cite web |last=Leyden |first=John |title=Patch Bash NOW: 'Shell Shock' bug blasts OS X, Linux systems wide open |url=https://www.theregister.co.uk/2014/09/24/bash_shell_vuln/ |work=[[The Register]] |date=September 24, 2014 |access-date=September 25, 2014 |archive-date=October 16, 2014 |archive-url=https://web.archive.org/web/20141016214010/http://www.theregister.co.uk/2014/09/24/bash_shell_vuln |url-status=live }}</ref><ref name="NYT-20140925-NP">{{cite news |last=Perlroth |first=Nicole |title=Security Experts Expect 'Shellshock' Software Bug in Bash to Be Significant |url=https://www.nytimes.com/2014/09/26/technology/security-experts-expect-shellshock-software-bug-to-be-significant.html |date=September 25, 2014 |work=[[The New York Times]] |access-date=September 25, 2014 |archive-date=April 5, 2019 |archive-url=https://web.archive.org/web/20190405000511/https://www.nytimes.com/2014/09/26/technology/security-experts-expect-shellshock-software-bug-to-be-significant.html |url-status=live }}</ref><ref name="ZDN-20140929">{{cite web |last=Seltzer |first=Larry |title=Shellshock makes Heartbleed look insignificant |archive-url=https://web.archive.org/web/20160514191755/http://www.zdnet.com/article/hackers-jump-on-the-shellshock-bash-bandwagon/ |archive-date=May 14, 2016 |url=http://www.zdnet.com/shellshock-makes-heartbleed-look-insignificant-7000034143/ |date=29 September 2014 |work=[[ZDNet]]}}</ref> Patches to fix the bugs were made available soon after the bugs were identified.

==History==
While bash is considered Unix-like,<ref>
{{ cite web
|url=ftp://ftp.cwru.edu/pub/bash/FAQ
|archive-url=https://web.archive.org/web/20180901171316/ftp://ftp.cwru.edu/pub/bash/FAQ
|archive-date=September 1, 2018
|url-status=dead
|title=Bash FAQ, version 4.14
|access-date=April 9, 2016
|df=mdy-all
}}
</ref> it's also available on MacOS, Windows, BeOS,<ref name="forb">
{{ Cite web
|url=https://www.forbes.com/1999/01/25/feat.html
|title=A desktop alternative
|website=Forbes
}} </ref><ref>
{{ Cite web
|url=http://testou.free.fr/www.beatjapan.org/mirror/www.be.com/documentation/user_docs/app_a_commandline.html
|title=Appendix A: Using the BeOS Command Line Shell
|website=testou.free.fr
}} </ref> and Haiku. <ref>
{{ cite web
| url=https://www.haiku-os.org/docs/userguide/en/applications/terminal.html
| title=Terminal
}} </ref>


==History==
[[Brian Fox (computer programmer)|Brian Fox]] began [[Computer programming|coding]] Bash on January 10, 1988,<ref>{{Citation
[[Brian Fox (computer programmer)|Brian Fox]] began [[Computer programming|coding]] Bash on January 10, 1988,<ref>{{Citation
| author = Brian Fox
| author = Brian Fox
Line 93: Line 103:
| archive-url = https://web.archive.org/web/20180928193215/http://ftp.gnu.org/gnu/bash/bash-1.14.7.tar.gz
| archive-url = https://web.archive.org/web/20180928193215/http://ftp.gnu.org/gnu/bash/bash-1.14.7.tar.gz
| url-status = live
| url-status = live
}}</ref> after [[Richard Stallman]] became dissatisfied with the lack of progress being made by a prior developer.<ref name=GNUBSD/> Stallman and the [[Free Software Foundation]] (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.<ref name=GNUBSD/><ref>
}}</ref> after [[Richard Stallman]] became dissatisfied with the lack of progress being made by a prior developer.<ref name=GNUBSD/> Stallman and the [[Free Software Foundation|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.<ref name=GNUBSD/><ref>
{{cite web
{{cite web
| access-date = 21 March 2011
| archive-url= https://web.archive.org/web/20110424064815/https://www.gnu.org/gnu/thegnuproject.html| archive-date=April 24, 2011
| author = [[Richard Stallman]]
| author = [[Richard Stallman]]
| title = About the GNU Project
| date = 3 October 2010
| publisher = [[Free Software Foundation]]
| publisher = [[Free Software Foundation]]
| quote = Free Software Foundation employees have written and maintained a number of GNU software packages. Two notable ones are the C library and the shell. ... We funded development of these programs because the GNU Project was not just about tools or a development environment. Our goal was a complete operating system, and these programs were needed for that goal.
| date = October 3, 2010
| title = About the GNU Project
| url = https://www.gnu.org/gnu/thegnuproject.html
| url = https://www.gnu.org/gnu/thegnuproject.html
| access-date = March 21, 2011
| url-status = live
}}
| quote = Free Software Foundation employees have written and maintained a number of GNU software packages. Two notable ones are the C library and the shell. … We funded development of these programs because the GNU Project was not just about tools or a development environment. Our goal was a complete operating system, and these programs were needed for that goal.
</ref>
| archive-url= https://web.archive.org/web/20110424064815/https://www.gnu.org/gnu/thegnuproject.html| archive-date=April 24, 2011 | url-status= live}}
</ref> Fox released Bash as a beta, version .99, on June 8, 1989,<ref name=BashBeta/> and remained the primary maintainer until sometime between mid-1992<ref>{{Cite newsgroup
Fox released Bash as a beta, version .99, on June 8, 1989,
<ref name=BashBeta/> and remained the primary maintainer until sometime between mid-1992
<ref>
{{ Cite newsgroup
| title = January 1993 GNU's Bulletin
| title = January 1993 GNU's Bulletin
| author = len (g...@prep.ai.mit.edu)
| author = len (g...@prep.ai.mit.edu)
Line 114: Line 130:
| archive-url = https://web.archive.org/web/20210302213455/https://groups.google.com/forum/
| archive-url = https://web.archive.org/web/20210302213455/https://groups.google.com/forum/
| url-status = live
| url-status = live
}}
}}</ref> and mid-1994,<ref name="Bourne shell grammar">{{cite web|first=Chet|last=Ramey|title=Bash - the GNU shell (Reflections and Lessons Learned)|url=http://www.linuxjournal.com/article/2800#N0xa50890.0xb46380|access-date=November 13, 2008| date=August 1, 1994|work=[[Linux Journal]]| archive-url= https://web.archive.org/web/20081205082152/http://www.linuxjournal.com/article/2800| archive-date=December 5, 2008 | url-status= live}}</ref> when he was laid off from FSF<ref>{{Citation
</ref> and mid-1994,
| title = Dates in your Computerworld interview
<ref name="Bourne shell grammar">
| author = Chet Ramey
{{ cite web
| date = October 31, 2010
|first=Chet
| url = https://www.scribd.com/doc/40556434/2010-10-31-Chet-Ramey-Early-Bash-Dates
|last=Ramey
| access-date = October 31, 2010
|title=Bash - the GNU shell (Reflections and Lessons Learned)
| archive-date = July 20, 2012
|url=http://www.linuxjournal.com/article/2800#N0xa50890.0xb46380
| archive-url = https://web.archive.org/web/20120720124341/http://www.scribd.com/doc/40556434/2010-10-31-Chet-Ramey-Early-Bash-Dates
|access-date=November 13, 2008
| url-status = live
| date=August 1, 1994
}}</ref> and his responsibility was transitioned to another early contributor, Chet Ramey.<ref>{{Cite newsgroup
|work=[[Linux Journal]]
| title = Bash 0.99 fixes & improvements
| archive-url= https://web.archive.org/web/20081205082152/http://www.linuxjournal.com/article/2800
| author = Chet Ramey
| date = June 12, 1989
| archive-date=December 5, 2008
| url-status= live
| newsgroup = gnu.bash.bug
}}
| url = https://groups.google.com/group/gnu.bash.bug/msg/1fc7b688f5d44438?hl=en
</ref> when he was laid off from FSF
| access-date = November 1, 2010
<ref>
| archive-date = November 10, 2012
{{ Citation
| archive-url = https://web.archive.org/web/20121110194014/http://groups.google.com/group/gnu.bash.bug/msg/1fc7b688f5d44438?hl=en
| title = Dates in your Computerworld interview
| url-status = live
| author = Chet Ramey
}}</ref><ref>{{Cite newsgroup
| title = Some bash-1.02 fixes
| date = October 31, 2010
| url = https://www.scribd.com/doc/40556434/2010-10-31-Chet-Ramey-Early-Bash-Dates
| author = Chet Ramey
| date = July 24, 1989
| access-date = October 31, 2010
| newsgroup = gnu.bash.bug
| archive-date = July 20, 2012
| archive-url = https://web.archive.org/web/20120720124341/http://www.scribd.com/doc/40556434/2010-10-31-Chet-Ramey-Early-Bash-Dates
| url = https://groups.google.com/group/gnu.bash.bug/msg/072a03645663caea?hl=en
| access-date = October 30, 2010
| url-status = live
}}
| archive-date = November 10, 2012
</ref> and his responsibility was transitioned to another early contributor, Chet Ramey.
| archive-url = https://web.archive.org/web/20121110194034/http://groups.google.com/group/gnu.bash.bug/msg/072a03645663caea?hl=en
<ref name="computerworld-Hamilton-Ramey">
| url-status = live
{{ cite news
}}</ref><ref>{{Cite newsgroup
| last1 = Hamilton
| title = Availability of bash 1.05
| author = Brian Fox
| first1 = Naomi
| title = The A-Z of Programming Languages: BASH/Bourne-Again Shell
| date = March 2, 1990
| website = [[Computerworld]]
| newsgroup = gnu.bash.bug
| url = https://groups.google.com/group/gnu.bash.bug/msg/e6112ccc8866e2f4?hl=en
| url = http://www.computerworld.com.au/article/222764/
| archive-url = https://web.archive.org/web/20161108230747/http://www.computerworld.com.au/article/222764/
| access-date = October 30, 2010
| archive-date = November 10, 2012
| archive-date = 8 November 2016
| access-date = 1 March 2022
| archive-url = https://web.archive.org/web/20121110194052/http://groups.google.com/group/gnu.bash.bug/msg/e6112ccc8866e2f4?hl=en
| date = 30 March 2008 <!-- https://web.archive.org/web/20081205093826/http://www.computerworld.com.au/index.php/id;1591223321;pp;2;fp;16;fpid;1 -->
| url-status = live
}}</ref>
}}
</ref>
<ref name="tiswww.case.edu-Ramey-BASH">
{{ cite web
| last1 = Ramey
| first1 = Chet
| title = The GNU Bourne-Again Shell
| url = https://tiswww.case.edu/php/chet/bash/bashtop.html
| website = Technology Infrastructure Services
| publisher = [[Case Western Reserve University]]
| access-date = 1 March 2022
| date = 2021-04-20
}}
</ref>
<ref>
{{ Cite newsgroup
| title = Bash 0.99 fixes & improvements
| author = Chet Ramey
| date = June 12, 1989
| newsgroup = gnu.bash.bug
| url = https://groups.google.com/group/gnu.bash.bug/msg/1fc7b688f5d44438?hl=en
| access-date = November 1, 2010
| archive-date = November 10, 2012
| archive-url = https://web.archive.org/web/20121110194014/http://groups.google.com/group/gnu.bash.bug/msg/1fc7b688f5d44438?hl=en
| url-status = live
}}
</ref>
<ref>
{{ Cite newsgroup
| title = Some bash-1.02 fixes
| author = Chet Ramey
| date = July 24, 1989
| newsgroup = gnu.bash.bug
| url = https://groups.google.com/group/gnu.bash.bug/msg/072a03645663caea?hl=en
| access-date = October 30, 2010
| archive-date = November 10, 2012
| archive-url = https://web.archive.org/web/20121110194034/http://groups.google.com/group/gnu.bash.bug/msg/072a03645663caea?hl=en
| url-status = live
}}
</ref>
<ref>
{{ Cite newsgroup
| title = Availability of bash 1.05
| author = Brian Fox
| date = March 2, 1990
| newsgroup = gnu.bash.bug
| url = https://groups.google.com/group/gnu.bash.bug/msg/e6112ccc8866e2f4?hl=en
| access-date = October 30, 2010
| archive-date = November 10, 2012
| archive-url = https://web.archive.org/web/20121110194052/http://groups.google.com/group/gnu.bash.bug/msg/e6112ccc8866e2f4?hl=en
| url-status = live
}}
</ref>


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<ref>{{cite book
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
<ref>
{{ cite book
| title = CompTIA Linux+ Powered by Linux Professional Institute Study Guide: Exam LX0-103 and Exam LX0-104
| title = CompTIA Linux+ Powered by Linux Professional Institute Study Guide: Exam LX0-103 and Exam LX0-104
| edition = 3rd
| edition = 3rd
| publisher = John Wiley & Sons, Inc.
| publisher = John Wiley & Sons, Inc.
| date = April 2015
| date = April 2015
| isbn = 978-1-119-02122-3
| isbn = 978-1-119-02122-3
| last1 = Bresnahan
| last1 = Bresnahan
| first1 = Christine
| first1 = Christine
| last2 = Blum
| last2 = Blum
| first2 = Richard
| first2 = Richard
| url = https://books.google.com/books?id=2P3zBgAAQBAJ&q=%22most+popular%22+linux+shell&pg=PA5
| url = https://books.google.com/books?id=2P3zBgAAQBAJ&q=%22most+popular%22+linux+shell&pg=PA5
| quote = In Linux, most users run bash because it is the most popular shell.
| quote = In Linux, most users run bash because it is the most popular shell.
| page = 5
| page = 5
| access-date = June 6, 2016
| access-date = June 6, 2016
| archive-date = March 2, 2021
| archive-date = March 2, 2021
| archive-url = https://web.archive.org/web/20210302212409/https://books.google.com/books?id=2P3zBgAAQBAJ&q=%22most+popular%22+linux+shell&pg=PA5
| archive-url = https://web.archive.org/web/20210302212409/https://books.google.com/books?id=2P3zBgAAQBAJ&q=%22most+popular%22+linux+shell&pg=PA5
| url-status = live
| url-status = live
}}
}}</ref><ref>{{cite book
</ref>
| title = Mastering Linux
<ref>
| publisher = John Wiley & Sons, Inc.
{{ cite book
| date = February 2006
| title = Mastering Linux
| isbn = 978-0-7821-5277-7
| publisher = John Wiley & Sons, Inc.
| last1 = Danesh
| date = February 2006
| first1 = Arman
| isbn = 978-0-7821-5277-7
| last2 = Jang
| first2 = Michael
| last1 = Danesh
| first1 = Arman
| url = https://books.google.com/books?id=tIjrVYbZmUAC&q=bash+most+popular+unix+shell&pg=PA363
| last2 = Jang
| quote = The Bourne Again Shell (bash) is the most common shell installed with Linux distributions.
| page = 363
| first2 = Michael
| url = https://books.google.com/books?id=tIjrVYbZmUAC&q=bash+most+popular+unix+shell&pg=PA363
| access-date = June 6, 2016
| quote = The Bourne Again Shell (bash) is the most common shell installed with Linux distributions.
| archive-date = March 2, 2021
| page = 363
| archive-url = https://web.archive.org/web/20210302212410/https://books.google.com/books?id=tIjrVYbZmUAC&q=bash+most+popular+unix+shell&pg=PA363
| access-date = June 6, 2016
| url-status = live
| archive-date = March 2, 2021
}}</ref> (although [[Almquist shell]] may be the default scripting shell) and on Apple's macOS releases before [[MacOS Catalina|Catalina]] in October 2019.<ref>{{Cite book
| archive-url = https://web.archive.org/web/20210302212410/https://books.google.com/books?id=tIjrVYbZmUAC&q=bash+most+popular+unix+shell&pg=PA363
| title = Beginning Shell Scripting
| url-status = live
| publisher = John Wiley & Sons, Inc.
}}
| date = April 2005
</ref> and on Apple's macOS releases before [[MacOS Catalina|Catalina]] in October 2019.
| isbn = 978-0-7645-9791-6
<ref>
| last1 = Foster-Johnson
{{ Cite book
| first1 = Eric
| title = Beginning Shell Scripting
| last2 = Welch
| first2 = John C.
| publisher = John Wiley & Sons, Inc.
| last3 = Anderson
| date = April 2005
| isbn = 978-0-7645-9791-6
| first3 = Micah
| last1 = Foster-Johnson
| url = https://books.google.com/books?id=dwIRERUpQPEC&q=bash+most+popular+unix+shell&pg=PA6
| first1 = Eric
| quote = Bash is by far the most popular shell and forms the default shell on Linux and Mac OSX systems.
| page = 6
| last2 = Welch
| first2 = John C.
| access-date = June 6, 2016
| last3 = Anderson
| archive-date = March 2, 2021
| first3 = Micah
| archive-url = https://web.archive.org/web/20210302212410/https://books.google.com/books?id=dwIRERUpQPEC&q=bash+most+popular+unix+shell&pg=PA6
| url = https://books.google.com/books?id=dwIRERUpQPEC&q=bash+most+popular+unix+shell&pg=PA6
| url-status = live
| quote = Bash is by far the most popular shell and forms the default shell on Linux and Mac OSX systems.
}}</ref><ref name="zsh1">{{cite web|url=https://support.apple.com/en-us/HT208050|title=Use zsh as the default shell on your Mac - Apple Support|access-date=1 July 2019|archive-date=December 2, 2019|archive-url=https://web.archive.org/web/20191202143802/https://support.apple.com/en-us/HT208050|url-status=live}}</ref><ref name="zsh2">{{Cite web|url=https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features|title=Apple replaces bash with zsh as the default shell in macOS Catalina|last=Warren|first=Tom|date=June 4, 2019|website=The Verge|access-date=June 13, 2019|archive-date=June 10, 2019|archive-url=https://web.archive.org/web/20190610051842/https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features|url-status=live}}</ref> Bash has also been ported to [[Microsoft Windows]] and distributed with [[Cygwin]] and [[MinGW]], to [[DOS]] by the [[DJGPP]] project, to [[Novell NetWare]], to [[OpenVMS]] by the GNV project,<ref>{{cite web|url=https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/|access-date=2020-09-04|title=Installing the new GNV packages|archive-date=October 3, 2020|archive-url=https://web.archive.org/web/20201003182204/https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/|url-status=live}}</ref> to [[ArcaOS]],<ref>{{cite web|url=https://www.arcanoae.com/wiki/arcaos/compatibility-subsystems/|title=Compatibility Subsystems|access-date=2020-09-04|archive-date=September 23, 2020|archive-url=https://web.archive.org/web/20200923001119/https://www.arcanoae.com/wiki/arcaos/compatibility-subsystems/|url-status=live}}</ref> and to [[Android (operating system)|Android]] via various terminal emulation applications.
| page = 6
| access-date = June 6, 2016
| archive-date = March 2, 2021
| archive-url = https://web.archive.org/web/20210302212410/https://books.google.com/books?id=dwIRERUpQPEC&q=bash+most+popular+unix+shell&pg=PA6
| url-status = live
}}
</ref>
<ref name="zsh1">
{{ cite web
|url=https://support.apple.com/en-us/HT208050
|title=Use zsh as the default shell on your Mac - Apple Support
|access-date=1 July 2019
|archive-date=December 2, 2019
|archive-url=https://web.archive.org/web/20191202143802/https://support.apple.com/en-us/HT208050
|url-status=live
}}
</ref>
<ref name="zsh2">
{{ Cite web
|url=https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features
|title=Apple replaces bash with zsh as the default shell in macOS Catalina
|last=Warren
|first=Tom
|date=June 4, 2019
|website=The Verge
|access-date=June 13, 2019
|archive-date=June 10, 2019
|archive-url=https://web.archive.org/web/20190610051842/https://www.theverge.com/2019/6/4/18651872/apple-macos-catalina-zsh-bash-shell-replacement-features
|url-status=live
}}
</ref> Bash has also been ported to [[Microsoft Windows]]
<ref>
{{cite web|url=https://github.com/Microsoft/BashOnWindows/issues/107|title=Missing source code - GPL compliance? · Issue #107 · Microsoft/WSL|website=GitHub|access-date=July 8, 2016|archive-date=September 24, 2019|archive-url=https://web.archive.org/web/20190924163108/https://github.com/microsoft/WSL/issues/107|url-status=live}}
</ref>
<ref>
{{ cite web
|title=GNU Bash
|url=http://www.softpedia.com/get/System/System-Miscellaneous/GNU-Bash.shtml
|website=[[Softpedia]]|date=January 23, 2010
|publisher=SoftNews
|access-date=9 April 2016
|archive-date=October 21, 2017
|archive-url=https://web.archive.org/web/20171021004857/http://www.softpedia.com/get/System/System-Miscellaneous/GNU-Bash.shtml|url-status=live
}}
</ref> and distributed with [[Cygwin]] and [[MinGW]], to [[DOS]] by the [[DJGPP]] project, to [[Novell NetWare]], to [[OpenVMS]] by the GNV project,<ref>{{cite web|url=https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/|access-date=2020-09-04|title=Installing the new GNV packages|archive-date=October 3, 2020|archive-url=https://web.archive.org/web/20201003182204/https://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/|url-status=live}}</ref> to [[ArcaOS]],<ref>{{cite web|url=https://www.arcanoae.com/wiki/arcaos/compatibility-subsystems/|title=Compatibility Subsystems|access-date=2020-09-04|archive-date=September 23, 2020|archive-url=https://web.archive.org/web/20200923001119/https://www.arcanoae.com/wiki/arcaos/compatibility-subsystems/|url-status=live}}</ref> and to [[Android (operating system)|Android]] via various terminal emulation applications.


In September 2014, Stéphane Chazelas, a Unix/Linux specialist,<ref>{{cite news |last1=Juliana |first1=Cino |title=Linux bash exit status and how to set exit status in bash - Techolac |url=https://www.techolac.com/linux/linux-bash-exit-status-and-how-to-set-exit-status-in-bash/ |access-date=21 June 2019 |date=10 June 2017 |archive-date=June 21, 2019 |archive-url=https://web.archive.org/web/20190621183753/https://www.techolac.com/linux/linux-bash-exit-status-and-how-to-set-exit-status-in-bash/ |url-status=live }}</ref> discovered a [[security bug]] in the program. The bug, first disclosed on September 24, was named [[Shellshock (software bug)|Shellshock]] and assigned the numbers {{CVE|2014-6271|2014-6277|2014-7169|leadout=and}}. The bug was regarded as severe, since [[Common Gateway Interface|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 variable]]s.<ref>{{Cite web
In September 2014, Stéphane Chazelas, a Unix/Linux specialist,<ref>{{cite news |last1=Juliana |first1=Cino |title=Linux bash exit status and how to set exit status in bash - Techolac |url=https://www.techolac.com/linux/linux-bash-exit-status-and-how-to-set-exit-status-in-bash/ |access-date=21 June 2019 |date=10 June 2017 |archive-date=June 21, 2019 |archive-url=https://web.archive.org/web/20190621183753/https://www.techolac.com/linux/linux-bash-exit-status-and-how-to-set-exit-status-in-bash/ |url-status=live }}</ref> discovered a [[security bug]] in the program. The bug, first disclosed on September 24, was named [[Shellshock (software bug)|Shellshock]] and assigned the numbers {{CVE|2014-6271|2014-6277|2014-7169|leadout=and}}. The bug was regarded as severe, since [[Common Gateway Interface|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 variable]]s.<ref>{{Cite web
Line 221: Line 336:


==Features==
==Features==
As a [[Command-line interface|command processor]], Bash operates within a [[Terminal emulator|text window]] where users input commands to execute various tasks. It also supports the execution of commands from files, known as [[shell script]]s, facilitating [[automation]]. In keeping with [[Unix shell]] conventions, Bash incorporates a rich set of features, including:
The Bash [[command (computing)|command]] syntax is a [[superset]] of the Bourne shell command syntax. Bash supports [[brace expansion]],<ref>{{Cite web |title=Brace Expansion (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html |access-date=2024-01-10 |website=www.gnu.org}}</ref> [[command line completion]] (Programmable Completion),<ref>{{Cite web|url=https://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion|title=Bash Reference Manual|website=www.gnu.org|access-date=March 27, 2018|archive-date=March 15, 2018|archive-url=https://web.archive.org/web/20180315115230/http://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion|url-status=live}}</ref> basic debugging<ref>{{cite web|url=http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html|title=Debugging Bash scripts|website=tldp.org|access-date=November 20, 2018|archive-date=November 4, 2018|archive-url=https://web.archive.org/web/20181104185300/http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html|url-status=live}}</ref><ref>{{Cite web |title=The Set Builtin (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html |access-date=2024-01-10 |website=www.gnu.org}}</ref> and [[Signal (IPC)|signal handling]] (using <code>trap</code>) since bash 2.05a<ref>{{Cite web|url=https://wiki-dev.bash-hackers.org/scripting/bashchanges|title=Bash changes [Bash Hackers Wiki (DEV 20200708T2203)]|website=wiki-dev.bash-hackers.org|access-date=September 23, 2019|archive-date=September 23, 2019|archive-url=https://web.archive.org/web/20190923203509/https://wiki-dev.bash-hackers.org/scripting/bashchanges|url-status=live}}</ref><ref>{{Cite web |title=Bourne Shell Builtins (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html |access-date=2024-01-10 |website=www.gnu.org}}</ref> among other features. Bash can execute the vast majority of Bourne shell scripts without modification, with the exception of Bourne shell scripts stumbling into fringe syntax behavior interpreted differently in Bash or attempting to run a system command matching a newer Bash builtin, etc. Bash command syntax includes ideas drawn from the [[KornShell|Korn Shell]] (ksh) and the [[C shell]] (csh) such as command line editing, [[command history]] (<code>history</code> command),<ref>{{Cite web|url=https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-History-Builtins|title=Bash Reference Manual|website=www.gnu.org|access-date=September 15, 2019|archive-date=September 15, 2019|archive-url=https://web.archive.org/web/20190915123105/http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-History-Builtins|url-status=live}}</ref> the directory stack, the <code>$RANDOM</code> and <code>$PPID</code> variables, and POSIX [[command substitution]] syntax <code>$(…)</code>.
* [[Interactivity|Interactive]] and non-interactive [[Function (computer programming)|invocation]]
* Execution of:
** External (to the [[Shell (computing)|shell]]) [[Unix|UNIX]]-style [[Command (computing)|commands]], such as '[[ls]]' or '[[Ln (Unix)|ln]]', which are actually separate [[Computer program|programs]]
** Internal "commands" such as [[Alias (command)|aliases]], [[Shell builtin|built-ins]] or [[Function (computer programming)|functions]], and
** [[File system|Files]] containing such commands, i.e., "[[shell script]]s," which do not require compilation before execution and which can be invoked as commands by using their filename.
* [[Command history]], [[Job (computing)|jobs]] / [[Job control (Unix)|job control]] and [[Command-line completion|tab completion]] in interactive mode
* A built-in "help" command, a [[man page]], and an [[Info (Unix)|info page]]
* Shell [[Compatibility mode|compatibility]] and [[Porting|portability]] (i.e., [[POSIX terminal interface|POSIX]]) modes
* [[Control flow|Control structures]] for [[Conditional (computer programming)|condition-testing]] and [[iteration]]
* [[Unix|UNIX]]-style [[Pipeline (Unix)|pipelines]]
* Configurable execution environment(s)<ref>{{Cite web|url=https://www.gnu.org/software/bash/manual/html_node/Command-Execution-Environment.html|title=Command Execution Environment (Bash Reference Manual)|website=www.gnu.org}}</ref>
* [[Command-line interface|Command line]] [[parsing]]
** [[String literal|Quoting]] rules
** [[Parameter (computer programming)|Parameters]] (or "[[Variable (computer science)|variables]]"), [[Array (data type)|arrays]] and [[associative array]]s
** "[[command substitution|Command]]," arithmetic and "[[Process substitution|process]]" substitutions
** "[[Text segmentation|Word splitting]]"
** Filename expansion ([[Glob (programming)|globbing]]) and [[pattern matching]]
** Quote removal
* Command name lookup, including "[[Alias (command)|aliases]]," "[[Function (computer programming)|functions]]," [[Shell builtin|shell built-ins]] and shell keywords
* [[Redirection (computing)|Redirections]] of inputs, outputs and error data streams, including "[[here document]]s" and "here strings"
* [[Child process|Subshells]]
* [[Exit status]] codes
* [[Signal (IPC)|Signaling]] as a means of [[inter-process communication]]
* Asynchronous execution
* ANSI-C quoting
* Brace and tilde expansions
* Configurable [[Command-line interface#Command prompt|prompt]] and command line editing with [[GNU Readline|GNU readline]] in interactive mode
* Shell and [[Session (computer science)|session]] startup files ([[Hidden file and hidden directory|dotfiles]]) such as '~/.bashrc'
* Various settings and shell options with the 'set' and 'shopt' [[Built-in command|built-ins]]
* Execution traces ("xtrace"): lightweight [[Logging (computing)|logging]] for [[debugging]] purposes

The [[Keyword (computer programming)|keywords]], [[Syntax (programming languages)|syntax]], [[Scope (computer science)#Dynamic scoping|dynamically scoped]] variables and other basic features of the [[formal language|language]] are all copied from [[Bourne shell|sh]]. Other features, e.g., [[C shell#History|history]], are copied from [[C shell|csh]] and [[KornShell|ksh]]. Bash is a [[POSIX]]-compliant shell, but with a number of extensions.

The Bash [[command (computing)|command]] syntax is a [[superset]] of the Bourne shell command syntax. Bash supports [[brace expansion]],<ref>{{Cite web |title=Brace Expansion (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html |access-date=2024-01-10 |website=www.gnu.org}}</ref> [[command line completion]] (Programmable Completion),<ref>{{Cite web|url=https://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion|title=Bash Reference Manual|website=www.gnu.org|access-date=March 27, 2018|archive-date=March 15, 2018|archive-url=https://web.archive.org/web/20180315115230/http://www.gnu.org/software/bash/manual/bash.html#Programmable-Completion|url-status=live}}</ref> basic debugging<ref>{{cite web|url=http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html|title=Debugging Bash scripts|website=tldp.org|access-date=November 20, 2018|archive-date=November 4, 2018|archive-url=https://web.archive.org/web/20181104185300/http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html|url-status=live}}</ref><ref>{{Cite web |title=The Set Builtin (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html |access-date=2024-01-10 |website=www.gnu.org}}</ref> and [[Signal (IPC)|signal handling]] (using <code>trap</code>) since bash 2.05a<ref>{{Cite web|url=https://wiki-dev.bash-hackers.org/scripting/bashchanges|title=Bash changes [Bash Hackers Wiki (DEV 20200708T2203)]|website=wiki-dev.bash-hackers.org|access-date=September 23, 2019|archive-date=September 23, 2019|archive-url=https://web.archive.org/web/20190923203509/https://wiki-dev.bash-hackers.org/scripting/bashchanges|url-status=live}}</ref><ref>{{Cite web |title=Bourne Shell Builtins (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html |access-date=2024-01-10 |website=www.gnu.org}}</ref> among other features. Bash can execute the vast majority of Bourne shell scripts without modification, with the exception of Bourne shell scripts stumbling into fringe syntax behavior interpreted differently in Bash or attempting to run a system command matching a newer Bash builtin, etc. Bash command syntax includes ideas drawn from the [[KornShell|Korn Shell]] (ksh) and the [[C shell]] (csh) such as command line editing, [[command history]] (<code>history</code> command),<ref>{{Cite web|url=https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-History-Builtins|title=Bash Reference Manual|website=www.gnu.org|access-date=September 15, 2019|archive-date=September 15, 2019|archive-url=https://web.archive.org/web/20190915123105/http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-History-Builtins|url-status=live}}</ref> the directory stack, the <code>$RANDOM</code> and <code>$PPID</code> variables, and POSIX [[command substitution]] syntax <code>$(...)</code>.


When a user presses the [[tab key]] within an interactive command-shell, Bash automatically uses [[command line completion]], since beta version 2.04,<ref>{{cite web|url=http://www.caliban.org/bash/index.shtml|title=Working more productively with bash 2.x/3.x|website=www.caliban.org|access-date=June 21, 2018|archive-date=June 29, 2018|archive-url=https://web.archive.org/web/20180629230903/http://www.caliban.org/bash/index.shtml|url-status=live}}</ref> to match partly typed program names, filenames and variable names. The Bash command-line completion system is very flexible and customizable, and is often packaged with functions that complete arguments and filenames for specific programs and tasks.
When a user presses the [[tab key]] within an interactive command-shell, Bash automatically uses [[command line completion]], since beta version 2.04,<ref>{{cite web|url=http://www.caliban.org/bash/index.shtml|title=Working more productively with bash 2.x/3.x|website=www.caliban.org|access-date=June 21, 2018|archive-date=June 29, 2018|archive-url=https://web.archive.org/web/20180629230903/http://www.caliban.org/bash/index.shtml|url-status=live}}</ref> to match partly typed program names, filenames and variable names. The Bash command-line completion system is very flexible and customizable, and is often packaged with functions that complete arguments and filenames for specific programs and tasks.


Bash's syntax has many extensions lacking in the Bourne shell. Bash can perform integer calculations ("arithmetic evaluation") without spawning external processes. It uses the <code>(())</code> command and the <code>$(())</code> variable syntax for this purpose. Its syntax simplifies [[redirection (computing)|I/O redirection]]. For example, it can redirect [[standard out]]put (stdout) and [[Standard error stream|standard error]] (stderr) at the same time using the <code>&></code> operator. This is simpler to type than the Bourne shell equivalent '<code>command > file 2>&1</code>'. Bash supports [[process substitution]] using the <code><(command)</code> and <code>>(command)</code>syntax, which substitutes the output of (or input to) a command where a filename is normally used. (This is implemented through ''/proc/fd/'' unnamed pipes on systems that support that, or via temporary [[named pipe]]s where necessary).
Bash's syntax has many extensions lacking in the Bourne shell. Bash can perform integer calculations ("arithmetic evaluation") without spawning external processes. It uses the <code>((...))</code> command and the <code>$((...))</code> variable syntax for this purpose. Its syntax simplifies [[redirection (computing)|I/O redirection]]. For example, it can redirect [[standard out]]put (stdout) and [[Standard error stream|standard error]] (stderr) at the same time using the <code>&></code> operator. This is simpler to type than the Bourne shell equivalent '<code>command > file 2>&1</code>'. Bash supports [[process substitution]] using the <code><(command)</code> and <code>>(command)</code>syntax, which substitutes the output of (or input to) a command where a filename is normally used. (This is implemented through ''/proc/fd/'' unnamed pipes on systems that support that, or via temporary [[named pipe]]s where necessary).


When using the 'function' keyword, Bash function declarations are not compatible with Bourne/Korn/POSIX scripts (the KornShell has the same problem when using 'function'), but Bash accepts the same function declaration syntax as the Bourne and Korn shells, and is POSIX-conformant. Because of these and other differences, Bash shell scripts are rarely runnable under the Bourne or Korn shell interpreters unless deliberately written with that compatibility in mind, which is becoming less common as Linux becomes more widespread. But in POSIX mode, Bash conforms with POSIX more closely.<ref name="GNUBASHREF">
When using the 'function' keyword, Bash function declarations are not compatible with Bourne/Korn/POSIX scripts (the KornShell has the same problem when using 'function'), but Bash accepts the same function declaration syntax as the Bourne and Korn shells, and is POSIX-conformant. Because of these and other differences, Bash shell scripts are rarely runnable under the Bourne or Korn shell interpreters unless deliberately written with that compatibility in mind, which is becoming less common as Linux becomes more widespread. But in POSIX mode, Bash conforms with POSIX more closely.<ref name="GNUBASHREF">
Line 242: Line 391:
Bash 3.0 supports in-process [[regular expression]] matching using a syntax reminiscent of [[Perl]].<ref>{{Cite web|url=http://www.tldp.org/LDP/abs/html/bashver3.html#BASH3REF|title=Advanced Bash-Scripting Guide|website=www.tldp.org|at=Section 37.2 (Bash, version 3)|access-date=2017-03-05|archive-date=May 5, 2017|archive-url=https://web.archive.org/web/20170505161903/http://tldp.org/LDP/abs/html/bashver3.html#BASH3REF|url-status=live}}</ref>
Bash 3.0 supports in-process [[regular expression]] matching using a syntax reminiscent of [[Perl]].<ref>{{Cite web|url=http://www.tldp.org/LDP/abs/html/bashver3.html#BASH3REF|title=Advanced Bash-Scripting Guide|website=www.tldp.org|at=Section 37.2 (Bash, version 3)|access-date=2017-03-05|archive-date=May 5, 2017|archive-url=https://web.archive.org/web/20170505161903/http://tldp.org/LDP/abs/html/bashver3.html#BASH3REF|url-status=live}}</ref>


In February 2009,<ref>{{cite web|url=http://tldp.org/LDP/abs/html/bashver4.html|title=Bash, version 4|website=tldp.org|access-date=June 25, 2018|archive-date=July 1, 2018|archive-url=https://web.archive.org/web/20180701001653/http://www.tldp.org/LDP/abs/html/bashver4.html|url-status=live}}</ref> Bash 4.0 introduced support for [[associative arrays]].<ref name="bashfaq061" /> Associative array indices are strings, in a manner similar to [[AWK]] or [[Tcl]].<ref>{{cite web|url=https://www.gnu.org/software/bash/manual/html_node/Arrays.html|title=Arrays (Bash Reference Manual)|website=www.gnu.org|access-date=July 4, 2018|archive-date=July 11, 2018|archive-url=https://web.archive.org/web/20180711142941/http://www.gnu.org/software/bash/manual/html_node/Arrays.html|url-status=live}}</ref> They can be used to emulate multidimensional arrays. Bash 4 also switches its license to [[GNU General Public License#Version 3|GPL-3.0-or-later]]; some users suspect this licensing change is why MacOS continues to use older versions.<ref>{{cite web|url=https://apple.stackexchange.com/questions/193411/update-bash-to-version-4-0-on-osx|title=macos - Update bash to version 4.0 on OSX|website=Ask Different|access-date=June 25, 2018|archive-date=June 25, 2018|archive-url=https://web.archive.org/web/20180625213216/https://apple.stackexchange.com/questions/193411/update-bash-to-version-4-0-on-osx|url-status=live}}</ref> Apple finally stopped using Bash in its operating systems as default shell with the release of MacOS Catalina in 2019.<ref name=":0">{{Cite web |last=Hughes |first=Matthew |date=2019-06-04 |title=Why does macOS Catalina use Zsh instead of Bash? Licensing |url=https://thenextweb.com/dd/2019/06/04/why-does-macos-catalina-use-zsh-instead-of-bash-licensing/ |url-status=live |archive-url=https://web.archive.org/web/20201231231721/https://thenextweb.com/dd/2019/06/04/why-does-macos-catalina-use-zsh-instead-of-bash-licensing/ |archive-date=December 31, 2020 |access-date=2021-01-12 |website=The Next Web |language=en-us}}</ref>
In February 2009,<ref>{{cite web|url=http://tldp.org/LDP/abs/html/bashver4.html|title=Bash, version 4|website=tldp.org|access-date=June 25, 2018|archive-date=July 1, 2018|archive-url=https://web.archive.org/web/20180701001653/http://www.tldp.org/LDP/abs/html/bashver4.html|url-status=live}}</ref> Bash 4.0 introduced support for [[associative arrays]].<ref name="bashfaq061" />
Associative array indices are strings, in a manner similar to [[AWK]] or [[Tcl]].<ref>{{cite web|url=https://www.gnu.org/software/bash/manual/html_node/Arrays.html|title=Arrays (Bash Reference Manual)|website=www.gnu.org|access-date=July 4, 2018|archive-date=July 11, 2018|archive-url=https://web.archive.org/web/20180711142941/http://www.gnu.org/software/bash/manual/html_node/Arrays.html|url-status=live}}</ref> They can be used to emulate multidimensional arrays. Bash 4 also switches its license to [[GNU General Public License#Version 3|GPL-3.0-or-later]]; some users suspect this licensing change is why MacOS continues to use older versions.<ref>{{cite web|url=https://apple.stackexchange.com/questions/193411/update-bash-to-version-4-0-on-osx|title=macos - Update bash to version 4.0 on OSX|website=Ask Different|access-date=June 25, 2018|archive-date=June 25, 2018|archive-url=https://web.archive.org/web/20180625213216/https://apple.stackexchange.com/questions/193411/update-bash-to-version-4-0-on-osx|url-status=live}}</ref> Apple finally stopped using Bash in its operating systems as default shell with the release of MacOS Catalina in 2019.<ref name=":0" />


===Brace expansion===
===Brace expansion===
Line 322: Line 470:


===Portability===
===Portability===
:See also: [https://www.gnu.org/software/bash/manual/bash.html#Major-Differences-From-The-Bourne-Shell Major Differences From The Bourne Shell]
Invoking Bash with the <code>--posix</code> option or stating <code>set -o posix</code> in a script causes Bash to conform very closely to the [[Posix#POSIX.2|POSIX 1003.2 standard]].<ref name=tldp>{{cite web|author=Mendel Cooper|title=Portability Issues|url=http://tldp.org/LDP/abs/html/portabilityissues.html|work=The Linux Documentation Project|publisher=ibiblio.org|access-date=January 26, 2012|archive-date=January 27, 2012|archive-url=https://web.archive.org/web/20120127105451/http://tldp.org/LDP/abs/html/portabilityissues.html|url-status=live}}</ref> Bash shell scripts intended for [[portability (computer science)|portability]] should take into account at least the POSIX shell standard. Some bash features not found in POSIX are:<ref name=tldp /><ref name=deb>{{cite web |title=10. Files |url=https://www.debian.org/doc/debian-policy/ch-files.html#scripts |website=Debian Policy Manual v4.5.0.2 |access-date=May 11, 2020 |archive-date=May 12, 2020 |archive-url=https://web.archive.org/web/20200512050159/https://www.debian.org/doc/debian-policy/ch-files.html#scripts |url-status=live }}</ref>
Invoking Bash with the <code>--posix</code> option or stating <code>set -o posix</code> in a script causes Bash to conform very closely to the [[Posix#POSIX.2|POSIX 1003.2 standard]].<ref name=tldp>{{cite web|author=Mendel Cooper|title=Portability Issues|url=http://tldp.org/LDP/abs/html/portabilityissues.html|work=The Linux Documentation Project|publisher=ibiblio.org|access-date=January 26, 2012|archive-date=January 27, 2012|archive-url=https://web.archive.org/web/20120127105451/http://tldp.org/LDP/abs/html/portabilityissues.html|url-status=live}}</ref> Bash shell scripts intended for [[portability (computer science)|portability]] should take into account at least the POSIX shell standard. Some bash features not found in POSIX are:<ref name=tldp /><ref name=deb>{{cite web |title=10. Files |url=https://www.debian.org/doc/debian-policy/ch-files.html#scripts |website=Debian Policy Manual v4.5.0.2 |access-date=May 11, 2020 |archive-date=May 12, 2020 |archive-url=https://web.archive.org/web/20200512050159/https://www.debian.org/doc/debian-policy/ch-files.html#scripts |url-status=live }}</ref>


Line 329: Line 476:
* Brace expansion
* Brace expansion
* Arrays and associative arrays
* Arrays and associative arrays
* The double bracket {{code|[[ ... ]]}} extended test construct and its regex matching
* The double bracket {{code| [[...]] }} extended test construct and its regex matching
* The double-parentheses arithmetic-evaluation construct (only {{code|(( ... ))}}; {{code|$(( ... ))}} is POSIX)
* The double-parentheses arithmetic-evaluation construct (only {{code|(( ... ))}}; {{code|$(( ... ))}} is POSIX)
* Certain string-manipulation operations in parameter expansion
* Certain string-manipulation operations in parameter expansion
Line 339: Line 486:
{{div col end}}
{{div col end}}


If a piece of code uses such a feature, it is called a "bashism" &ndash; a problem for portable use. Debian's {{code|checkbashisms}} and Vidar Holen's {{code|shellcheck}} can be used to make sure that a script does not contain these parts.<ref>{{man|1|checkbashisms|ManKier}}</ref><ref>{{man|1|shellcheck|ManKier}}</ref> The list varies depending on the actual target shell: Debian's policy allows some extensions in their scripts (as they are in the [[Almquist shell#Dash|dash]] shell),<ref name=deb/> while a script intending to support pre-POSIX Bourne shells, like [[autoconf]]'s {{code|configure}}, are even more limited in the features they can use.<ref>{{cite web |title=Portable Shell |url=https://www.gnu.org/software/autoconf/manual/html_node/Portable-Shell.html |website=Autoconf |access-date=20 January 2020 |archive-date=March 2, 2021 |archive-url=https://web.archive.org/web/20210302212413/https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Portable-Shell.html |url-status=live }}</ref>
If a piece of code uses such a feature, it is called a "bashism" a problem for portable use. Debian's {{code|checkbashisms}} and Vidar Holen's {{code|shellcheck}} can be used to make sure that a script does not contain these parts.<ref>{{man|1|checkbashisms|ManKier}}</ref><ref>{{man|1|shellcheck|ManKier}}</ref> The list varies depending on the actual target shell: Debian's policy allows some extensions in their scripts (as they are in the [[Almquist shell#Dash|dash]] shell),<ref name=deb/> while a script intending to support pre-POSIX Bourne shells, like [[autoconf]]'s {{code|configure}}, are even more limited in the features they can use.<ref>{{cite web |title=Portable Shell |url=https://www.gnu.org/software/autoconf/manual/html_node/Portable-Shell.html |website=Autoconf |access-date=20 January 2020 |archive-date=March 2, 2021 |archive-url=https://web.archive.org/web/20210302212413/https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Portable-Shell.html |url-status=live }}</ref>


===Keyboard shortcuts===
===Keyboard shortcuts===
Line 379: Line 526:
In the output, the number in brackets refers to the job id. The plus sign signifies the default process for <code>bg</code> and <code>fg</code>. The text "Running" and "Stopped" refer to the [[process state]]. The last string is the command that started the process.
In the output, the number in brackets refers to the job id. The plus sign signifies the default process for <code>bg</code> and <code>fg</code>. The text "Running" and "Stopped" refer to the [[process state]]. The last string is the command that started the process.


The state of a process can be changed using various commands. The <code>fg</code> command brings a process to the foreground, while <code>bg</code> sets a stopped process running in the background. <code>bg</code> and <code>fg</code> can take a job id as their first argument, to specify the process to act on. Without one, they use the default process, identified by a plus sign in the output of <code>jobs</code>. The <code>[[Kill_(command)|kill]]</code> command can be used to end a process prematurely, by sending it a [[Signal (IPC)|signal]]. The job id must be specified after a percent sign:
The state of a process can be changed using various commands. The <code>fg</code> command brings a process to the foreground, while <code>bg</code> sets a stopped process running in the background. <code>bg</code> and <code>fg</code> can take a job id as their first argument, to specify the process to act on. Without one, they use the default process, identified by a plus sign in the output of <code>jobs</code>. The <code>[[Kill (command)|kill]]</code> command can be used to end a process prematurely, by sending it a [[Signal (IPC)|signal]]. The job id must be specified after a percent sign:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 406: Line 553:


=== Program name ===
=== Program name ===
The program's name is a [[figure of speech]] or [[Wit|witticism]] which begins with an [[Homage (arts)|homage]] to [[Stephen R. Bourne|Stephen Bourne]], the creator of [[Bourne shell|one]] of the shell programs which have sometimes been considered superseded by the bash shell. His name is used as a [[pun]] on the [[Imagery|image]] of childbirth, and with that pun is added an [[allusion]] to the [[Christianity|Christian]] [[idiom]] of being "[[born again]]," or possibly the [[Buddhism|Buddhist]] idea of [[reincarnation]]. Sometimes considered a reference to [[Gospel of John|John]] 3 of the Christian [[New Testament]], [[Merriam-Webster]] has "born-again" defined as "person who has made a renewed ... ''commitment'' of faith.<ref>{{Cite web |title=Definition of BORN-AGAIN |url=https://www.merriam-webster.com/dictionary/born-again |access-date=2024-01-09 |website=www.merriam-webster.com |language=en}}</ref>" This idiom is then used to name the program: the ''Bourne Again SHell''.<ref>{{Cite web |title=Bash - GNU Project - Free Software Foundation |url=https://www.gnu.org/savannah-checkouts/gnu/bash/bash.html |access-date=2024-01-10 |website=www.gnu.org}}</ref><ref>{{Cite web |title=What is Bash? (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/What-is-Bash_003f.html |access-date=2024-01-09 |website=www.gnu.org}}</ref>
The program's name is a [[figure of speech]] or [[wit]]ticism which begins with an [[Homage (arts)|homage]] to [[Stephen R. Bourne|Stephen Bourne]], the creator of [[Bourne shell|one]] of the shell programs which have sometimes been considered superseded by the bash shell. His name is used as a [[pun]] on the [[Imagery|image]] of childbirth. With that pun, it would seem, is added an [[allusion]]: possibly to the [[Hinduism|Hindu]] or [[Buddhism|Buddhist]] idea of [[reincarnation]]; possibly to the [[Christianity|Christian]] [[idiom]] known as "being [[born again|born again;]]" or quite possibly just to the more abstract idea of [[mwod:renewal|renewal]]. While numerous [[English language|English]] [[Translation|translations]] of the Christian [[New Testament]], Book of [[Gospel of John|John]], [https://www.biblegateway.com/passage/?search=John%203&version=NIV chapter] [https://www.biblegateway.com/passage/?search=John%203&version=KJV 3] do contain the words "born again," [[Merriam-Webster|Merriam-Webster's]] dictionary has "born-again" defined as a "...person who has made a renewed or confirmed ''commitment''....<ref>{{Cite web |title=Definition of BORN-AGAIN |url=https://www.merriam-webster.com/dictionary/born-again |access-date=2024-01-09 |website=www.merriam-webster.com |language=en}}</ref>" Whatever the original touchstone may have been, in the end the program received the name, "the ''Bourne Again SHell''."<ref name="auto">{{Cite web |title=Bash - GNU Project - Free Software Foundation |url=https://www.gnu.org/savannah-checkouts/gnu/bash/bash.html |access-date=2024-01-10 |website=www.gnu.org}}</ref><ref>{{Cite web |title=What is Bash? (Bash Reference Manual) |url=https://www.gnu.org/software/bash/manual/html_node/What-is-Bash_003f.html |access-date=2024-01-09 |website=www.gnu.org}}</ref>


The [[acronym]] of that name then is "bash," a word meaning "to strike violently.<ref>{{Cite web |date=2024-01-05 |title=Definition of BASH |url=https://www.merriam-webster.com/dictionary/bash |access-date=2024-01-09 |website=www.merriam-webster.com |language=en}}</ref>" In the context of computer programming, to "violently hit something," such as a computer keyboard, could be considered a [[Hyperbole|hyperbolic]] [[Imagery|image]] of some ''frustration''. Such [[imagery]] of negative emotionality could be seen as standing in direct [[juxtaposition]] to the idea of becoming "born again."
The [[acronym]] of that name then is "bash," a word meaning "to strike violently.<ref>{{Cite web |date=2024-01-05 |title=Definition of BASH |url=https://www.merriam-webster.com/dictionary/bash |access-date=2024-01-09 |website=www.merriam-webster.com |language=en}}</ref>" In the context of computer programming, to "violently hit something," such as a computer keyboard, could be considered a [[Hyperbole|hyperbolic]] [[Imagery|image]] of some ''frustration''. Such [[imagery]] of negative emotionality could be seen as standing in direct [[juxtaposition]] to the idea of becoming "born again."


The naming could be considered an instance of [https://literarydevices.net/irony/ verbal] [[irony]] or [https://literarydevices.net/innuendo accidental] [[innuendo]]. Bash grammar was initially based on the grammars of the most popular Unix shell programs then currently in use, some of which were considered particularly difficult to use or ''frustrating'' at that time. As the years progressed, bash development has made its grammar more user-friendly,<ref>{{Cite web |title=BashGuide/Arrays - Greg's Wiki |url=https://mywiki.wooledge.org/BashGuide/Arrays |access-date=2024-01-10 |website=mywiki.wooledge.org}}</ref><ref>{{Cite web |title=CommandSubstitution - Greg's Wiki |url=https://mywiki.wooledge.org/CommandSubstitution |access-date=2024-01-10 |website=mywiki.wooledge.org}}</ref><ref>{{Cite web |title=BashGuide/TestsAndConditionals - Greg's Wiki |url=https://mywiki.wooledge.org/BashGuide/TestsAndConditionals#Conditional_Blocks_.28if.2C_test_and_.5B.5B.29 |access-date=2024-01-10 |website=mywiki.wooledge.org}}</ref><ref>{{Cite web |title=CHANGES - bash.git - bash |url=https://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES |access-date=2024-01-10 |website=git.savannah.gnu.org}}</ref><ref>{{Cite web |date=2021-02-14 |title=Bash changes [Bash Hackers Wiki] |url=https://wiki.bash-hackers.org/scripting/bashchanges |access-date=2024-01-10 |archive-url=https://web.archive.org/web/20210214062716/https://wiki.bash-hackers.org/scripting/bashchanges |archive-date=February 14, 2021 }}</ref><ref>{{Cite web |date=2021-02-11 |title=Obsolete and deprecated syntax [Bash Hackers Wiki] |url=https://wiki.bash-hackers.org/scripting/obsolete |access-date=2024-01-10 |archive-url=https://web.archive.org/web/20210211050502/https://wiki.bash-hackers.org/scripting/obsolete |archive-date=February 11, 2021 }}</ref> so much so that it seems likely that the bash project has been ''committed'' to improving its usablilty. Since then, bash has become the de facto default shell program in most Linux and Unix operating systems.
The naming could be considered an instance of verbal [[irony]]<ref>{{Cite web|url=https://literarydevices.net/irony/|title=Irony Definition, Common Examples, and Significance in Literature|date=August 31, 2020}}</ref> or accidental [[innuendo]].<ref>{{Cite web|url=https://literarydevices.net/innuendo/|title=Innuendo - Examples and Definition of Innuendo|date=January 2, 2014}}</ref> Bash grammar was initially based on the grammars of the most popular Unix shell programs then currently in use, some of which were considered particularly difficult to use or ''frustrating'' at that time. As the years progressed, bash development has made its grammar more user-friendly,<ref>{{Cite web |title=BashGuide/Arrays - Greg's Wiki |url=https://mywiki.wooledge.org/BashGuide/Arrays |access-date=2024-01-10 |website=mywiki.wooledge.org}}</ref><ref>{{Cite web |title=CommandSubstitution - Greg's Wiki |url=https://mywiki.wooledge.org/CommandSubstitution |access-date=2024-01-10 |website=mywiki.wooledge.org}}</ref><ref>{{Cite web |title=BashGuide/TestsAndConditionals - Greg's Wiki |url=https://mywiki.wooledge.org/BashGuide/TestsAndConditionals#Conditional_Blocks_.28if.2C_test_and_.5B.5B.29 |access-date=2024-01-10 |website=mywiki.wooledge.org}}</ref><ref>{{Cite web |title=CHANGES - bash.git - bash |url=https://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES |access-date=2024-01-10 |website=git.savannah.gnu.org}}</ref><ref>{{Cite web |date=2021-02-14 |title=Bash changes [Bash Hackers Wiki] |url=https://wiki.bash-hackers.org/scripting/bashchanges |access-date=2024-01-10 |archive-url=https://web.archive.org/web/20210214062716/https://wiki.bash-hackers.org/scripting/bashchanges |archive-date=February 14, 2021 }}</ref><ref>{{Cite web |date=2021-02-11 |title=Obsolete and deprecated syntax [Bash Hackers Wiki] |url=https://wiki.bash-hackers.org/scripting/obsolete |access-date=2024-01-10 |archive-url=https://web.archive.org/web/20210211050502/https://wiki.bash-hackers.org/scripting/obsolete |archive-date=February 11, 2021 }}</ref> so much so that it seems likely that the bash project has been ''committed'' to improving its usablilty. Since then, bash has become the de facto default shell program in most Linux and Unix operating systems.


=== Documentation ===
=== Documentation ===
As the standard upon which bash is based, the POSIX, or [https://pubs.opengroup.org/onlinepubs/9699919799/ IEEE Std 1003.1<sup>™</sup>], et seq, is informative.
As the standard upon which bash is based, the POSIX, or IEEE Std 1003.1,<ref>{{Cite web|url=https://pubs.opengroup.org/onlinepubs/9699919799/|title=The Open Group Base Specifications Issue 7, 2018 edition|website=pubs.opengroup.org}}</ref> et seq, is informative.


The Linux [https://tiswww.case.edu/php/chet/bash/bash.html man] [https://git.savannah.gnu.org/cgit/bash.git/tree/doc/bash.0 page] is intended to be the authoritative explanatory document for the understanding of how `bash` operates, while the GNU [https://www.gnu.org/software/bash/manual/index.html manual] is sometimes considered more user-friendly for reading. "You may also find information about Bash by running <kbd>info bash</kbd> ... or by looking at <code>/usr/share/doc/bash/</code>, <code>/usr/local/share/doc/bash/</code>, or similar directories on your system. A brief summary is available by running <kbd>bash --help</kbd>.<ref>{{Cite web |title=Bash - GNU Project - Free Software Foundation |url=https://www.gnu.org/savannah-checkouts/gnu/bash/bash.html |access-date=2024-01-10 |website=www.gnu.org}}</ref>"
The Linux man page<ref>{{Cite web|url=https://tiswww.case.edu/php/chet/bash/bash.html|title=BASH(1) Manual Page|website=tiswww.case.edu}}</ref><ref>{{Cite web|url=https://git.savannah.gnu.org/cgit/bash.git/tree/doc/bash.0|title=bash.0\doc - bash.git - bash|website=git.savannah.gnu.org}}</ref> is intended to be the authoritative explanatory document for the understanding of how `bash` operates, while the GNU [https://www.gnu.org/software/bash/manual/index.html manual] is sometimes considered more user-friendly for reading. "You may also find information about Bash by running <kbd>info bash</kbd> ... or by looking at <code>/usr/share/doc/bash/</code>, <code>/usr/local/share/doc/bash/</code>, or similar directories on your system. A brief summary is available by running <kbd>bash --help</kbd>.<ref name="auto"/>"


On modern Linuxes, information on shell built-in commands can be found by executing <code>help,</code> <code>help [built-in name]</code>or `man builtins` at a terminal prompt where bash is installed. Some commands, such as `echo`, `false`, `kill`, `printf`, `test` or `true`, depending on your system and on your locally installed version of bash, can refer to either a shell built-in or a system binary executable file. When one of these command name collisions occurs, bash will by default execute a given command line using the shell built-in. Specifying a binary executable's absolute path (i.e., `/bin/printf`) is one way of ensuring that the shell uses a system binary. This name collision issue also effects any "help summaries" viewed with `kill --help` and `/bin/kill --help`. Shell built-ins and system binary executable files of the same name often have differing options.
On modern Linuxes, information on shell built-in commands can be found by executing <code>help,</code> <code>help [built-in name]</code>or `man builtins` at a terminal prompt where bash is installed. Some commands, such as `echo`, `false`, `kill`, `printf`, `test` or `true`, depending on your system and on your locally installed version of bash, can refer to either a shell built-in or a system binary executable file. When one of these command name collisions occurs, bash will by default execute a given command line using the shell built-in. Specifying a binary executable's absolute path (i.e., `/bin/printf`) is one way of ensuring that the shell uses a system binary. This name collision issue also effects any "help summaries" viewed with `kill --help` and `/bin/kill --help`. Shell built-ins and system binary executable files of the same name often have differing options.

"The project maintainer also has a Bash page which includes Frequently Asked Questions",<ref>{{Cite web|url=https://tiswww.case.edu/php/chet/bash/bashtop.html|title=The GNU Bourne-Again Shell|website=tiswww.case.edu}}</ref><ref>{{Cite web|url=https://tiswww.case.edu/php/chet/bash/FAQ|title=Frequently Asked Questions}}</ref><ref name="auto"/> this FAQ is current as of bash version 5.1 and is no longer updated.

== Vulnerabilities ==
A [[Security bug|security hole]] in Bash dating from version 1.03 (August 1989),<ref name="Seclists-20141004">{{cite web |last=Chazelas |first=Stephane |date=4 October 2014 |title=oss-sec mailing list archives |url=http://seclists.org/oss-sec/2014/q4/102 |url-status=live |archive-url=https://web.archive.org/web/20141006093452/http://seclists.org/oss-sec/2014/q4/102 |archive-date=October 6, 2014 |access-date=4 October 2014 |work=Seclists.org}}</ref> dubbed [[Shellshock (software bug)|Shellshock]], was discovered in early September 2014 and quickly led to a range of [[Attack (computing)|attacks]] across the [[Internet]].<ref name="TR-20140924">{{cite web |last=Leyden |first=John |date=September 24, 2014 |title=Patch Bash NOW: 'Shell Shock' bug blasts OS X, Linux systems wide open |url=https://www.theregister.co.uk/2014/09/24/bash_shell_vuln/ |url-status=live |archive-url=https://web.archive.org/web/20141016214010/http://www.theregister.co.uk/2014/09/24/bash_shell_vuln |archive-date=October 16, 2014 |access-date=September 25, 2014 |work=[[The Register]]}}</ref><ref name="NYT-20140925-NP">{{cite news |last=Perlroth |first=Nicole |date=September 25, 2014 |title=Security Experts Expect 'Shellshock' Software Bug in Bash to Be Significant |url=https://www.nytimes.com/2014/09/26/technology/security-experts-expect-shellshock-software-bug-to-be-significant.html |url-status=live |archive-url=https://web.archive.org/web/20190405000511/https://www.nytimes.com/2014/09/26/technology/security-experts-expect-shellshock-software-bug-to-be-significant.html |archive-date=April 5, 2019 |access-date=September 25, 2014 |work=[[The New York Times]]}}</ref><ref name="ZDN-20140929">{{cite web |last=Seltzer |first=Larry |date=29 September 2014 |title=Shellshock makes Heartbleed look insignificant |url=http://www.zdnet.com/shellshock-makes-heartbleed-look-insignificant-7000034143/ |archive-url=https://web.archive.org/web/20160514191755/http://www.zdnet.com/article/hackers-jump-on-the-shellshock-bash-bandwagon/ |archive-date=May 14, 2016 |work=[[ZDNet]]}}</ref> Patches to fix the bugs were made available soon after the bugs were identified.

== Licensing ==
Since 4.0: [[GNU General Public License#Version 3|GPL-3.0-or-later]]
<ref name="license">
{{ cite web
| author = GNU Project
| author-link = GNU Project
| title = README file
| url = https://www.gnu.org/software/bash/
| quote = Bash is free software, distributed under the terms of the [GNU] General Public License as published by the Free Software Foundation, version 3 of the License (or any later version).
| access-date = April 16, 2014
| archive-date = April 26, 2019
| archive-url = https://web.archive.org/web/20190426210620/http://www.gnu.org/software/bash/
| url-status = live
}}
</ref>

1.11? to 3.2: [[GNU General Public License#Version 2|GPL-2.0-or-later]]
<ref>
{{ cite web
|url=http://www.oldlinux.org/Linux.old/bin/old/bash-1.11/
|title=bash-1.11
|website=oldlinux.org
|quote=See test.c for GPL-2.0-or-later
|access-date=June 9, 2021
|archive-date=October 15, 2021
|archive-url=https://web.archive.org/web/20211015233550/http://www.oldlinux.org/Linux.old/bin/old/bash-1.11/
|url-status=dead
}}
</ref>

0.99? to 1.05?: [[GNU General Public License#Version 1|GPL-1.0-or-later]]
<ref>
{{ cite web
|url=http://www.oldlinux.org/Linux.old/bin/old/bash-1.05.tar
|title=bash-1.05.tar
|website=oldlinux.org
}}
</ref>
<ref name="bashfaq061">
{{ Cite web
|title=BashFAQ/061 - Greg's Wiki
|url=https://mywiki.wooledge.org/BashFAQ/061
|access-date=2021-03-01
|website=mywiki.wooledge.org
|archive-date=March 2, 2021
|archive-url=https://web.archive.org/web/20210302212811/https://mywiki.wooledge.org/BashFAQ/061
|url-status=live
}}
</ref>
<ref>
{{ cite web
|url=https://unix.stackexchange.com/questions/243375/is-there-a-way-to-download-the-presumably-initial-bash-source-bash-0-99
|title=Is there a way to download the presumably initial bash source bash-0.99?
|website=unix.stackexchange.com
}}
</ref>


== Versions ==
"The project maintainer also has a [https://tiswww.case.edu/php/chet/bash/bashtop.html Bash page] which includes [https://tiswww.case.edu/php/chet/bash/FAQ Frequently Asked Questions],<ref>{{Cite web |title=Bash - GNU Project - Free Software Foundation |url=https://www.gnu.org/savannah-checkouts/gnu/bash/bash.html |access-date=2024-01-10 |website=www.gnu.org}}</ref>" this FAQ is current as of bash version 5.1 and is no longer updated.
A version is also available for [[Windows 10]] and [[Windows 11]] via the [[Windows Subsystem for Linux]].<ref>{{cite web |date=September 28, 2016 |title=How to install Bash shell command-line tool on Windows 10 |url=http://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 |url-status=live |archive-url=https://web.archive.org/web/20161120213017/http://www.windowscentral.com/how-install-bash-shell-command-line-windows-10 |archive-date=November 20, 2016 |access-date=November 20, 2016}}</ref><ref>{{Cite web |last=Hoffman |first=Chris |date=July 30, 2021 |title=How to Install the Windows Subsystem for Linux on Windows 11 |url=https://www.howtogeek.com/744328/how-to-install-the-windows-subsystem-for-linux-on-windows-11/ |access-date=2022-10-12 |website=How-To Geek |language=en-US}}</ref> It is also the default user shell in [[Solaris (operating system)|Solaris]] 11.<ref>{{cite web |title=User Environment Feature Changes |url=https://docs.oracle.com/cd/E23824_01/html/E24456/userenv-1.html |url-status=live |archive-url=https://web.archive.org/web/20180612144748/https://docs.oracle.com/cd/E23824_01/html/E24456/userenv-1.html |archive-date=June 12, 2018 |access-date=June 8, 2018 |publisher=Oracle}}</ref> Bash was also the default shell in [[BeOS]],<ref name="forb" /> and in versions of [[MacOS|Apple macOS]] from 10.3 (originally, the default shell was [[tcsh]]) to 10.15 ([[macOS Catalina]]), which changed the default shell to [[zsh]],<ref name="zsh2" /> although Bash remains available as an alternative shell.<ref name=":0" />


==Release history==
=== Release history ===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 557: Line 767:
{{Wikibooks|Bash Shell Scripting}}
{{Wikibooks|Bash Shell Scripting}}
* {{official website}}
* {{official website}}
* {{cite news |last1=Hamilton |first1=Naomi |title=The A-Z of Programming Languages: BASH/Bourne-Again Shell |website=[[Computerworld]] |url=http://www.computerworld.com.au/article/222764/ |archive-url=https://web.archive.org/web/20161108230747/http://www.computerworld.com.au/article/222764/ |archive-date=8 November 2016 |date=2008-05-30 <!-- https://web.archive.org/web/20081205093826/http://www.computerworld.com.au/index.php/id;1591223321;pp;2;fp;16;fpid;1
* {{cite news |last1=Hamilton |first1=Naomi |title=The A-Z of Programming Languages: BASH/Bourne-Again Shell |website=[[Computerworld]] |url=http://www.computerworld.com.au/article/222764/ |archive-url=https://web.archive.org/web/20161108230747/http://www.computerworld.com.au/article/222764/ |archive-date=8 November 2016 |date=2008-05-30 <!-- https://web.archive.org/web/20081205093826/http://www.computerworld.com.au/index.php/id;1591223321;pp;2;fp;16;fpid;1
-->}} (interview with GNU Bash's maintainer, Chet Ramey)
-->}} (interview with GNU Bash's maintainer, Chet Ramey)
* [https://www.gnu.org/software/bash/manual/bash.html#Major-Differences-From-The-Bourne-Shell Major Differences From The Bourne Shell]


{{GNU}}
{{GNU}}

Latest revision as of 00:49, 15 May 2024

Bash
Original author(s) Brian Fox
Developer(s)Chet Ramey
Initial release8 June 1989; 34 years ago (8 June 1989)
Stable release
5.2.21[1] Edit this on Wikidata / 9 November 2023
Repository
Written in C
Operating system
PlatformGNU
Available inMultilingual (gettext)
TypeUnix shell, command language
LicenseSince 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
Websitewww.gnu.org/software/bash/ Edit this on Wikidata

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

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 GCC (GNU Compiler Collection).[11] 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 sh. Other features, e.g., history, are copied from csh and ksh. Bash is a POSIX-compliant shell, but with a number of extensions.

History[edit]

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

Brian Fox began coding Bash on January 10, 1988,[16] after Richard Stallman became dissatisfied with the lack of progress being made by a prior developer.[5] 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.[5][17] Fox released Bash as a beta, version .99, on June 8, 1989, [7] and remained the primary maintainer until sometime between mid-1992 [18] and mid-1994, [19] when he was laid off from FSF [20] and his responsibility was transitioned to another early contributor, Chet Ramey. [21] [22] [23] [24] [25]

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 [26] [27] and on Apple's macOS releases before Catalina in October 2019. [28] [29] [30] Bash has also been ported to Microsoft Windows [31] [32] and distributed with Cygwin and MinGW, to DOS by the DJGPP project, to Novell NetWare, to OpenVMS by the GNV project,[33] to ArcaOS,[34] and to Android via various terminal emulation applications.

In September 2014, Stéphane Chazelas, a Unix/Linux specialist,[35] 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.[36]

Features[edit]

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, including:

The keywords, syntax, dynamically scoped variables and other basic features of the language are all copied from sh. Other features, e.g., history, are copied from csh and ksh. Bash is a POSIX-compliant shell, but with a number of extensions.

The Bash command syntax is a superset of the Bourne shell command syntax. Bash supports brace expansion,[38] command line completion (Programmable Completion),[39] basic debugging[40][41] and signal handling (using trap) since bash 2.05a[42][43] among other features. Bash can execute the vast majority of Bourne shell scripts without modification, with the exception of Bourne shell scripts stumbling into fringe syntax behavior interpreted differently in Bash or attempting to run a system command matching a newer Bash builtin, etc. Bash command syntax includes ideas drawn from the Korn Shell (ksh) and the C shell (csh) such as command line editing, command history (history command),[44] the directory stack, the $RANDOM and $PPID variables, and POSIX command substitution syntax $(...).

When a user presses the tab key within an interactive command-shell, Bash automatically uses command line completion, since beta version 2.04,[45] to match partly typed program names, filenames and variable names. The Bash command-line completion system is very flexible and customizable, and is often packaged with functions that complete arguments and filenames for specific programs and tasks.

Bash's syntax has many extensions lacking in the Bourne shell. Bash can perform integer calculations ("arithmetic evaluation") without spawning external processes. It uses the ((...)) command and the $((...)) variable syntax for this purpose. Its syntax simplifies I/O redirection. For example, it can redirect standard output (stdout) and standard error (stderr) at the same time using the &> operator. This is simpler to type than the Bourne shell equivalent 'command > file 2>&1'. Bash supports process substitution using the <(command) and >(command)syntax, which substitutes the output of (or input to) a command where a filename is normally used. (This is implemented through /proc/fd/ unnamed pipes on systems that support that, or via temporary named pipes where necessary).

When using the 'function' keyword, Bash function declarations are not compatible with Bourne/Korn/POSIX scripts (the KornShell has the same problem when using 'function'), but Bash accepts the same function declaration syntax as the Bourne and Korn shells, and is POSIX-conformant. Because of these and other differences, Bash shell scripts are rarely runnable under the Bourne or Korn shell interpreters unless deliberately written with that compatibility in mind, which is becoming less common as Linux becomes more widespread. But in POSIX mode, Bash conforms with POSIX more closely.[46]

Bash supports here documents. Since version 2.05b Bash can redirect standard input (stdin) from a "here string" using the <<< operator.

Bash 3.0 supports in-process regular expression matching using a syntax reminiscent of Perl.[47]

In February 2009,[48] Bash 4.0 introduced support for associative arrays.[49] Associative array indices are strings, in a manner similar to AWK or Tcl.[50] They can be used to emulate multidimensional arrays. Bash 4 also switches its license to GPL-3.0-or-later; some users suspect this licensing change is why MacOS continues to use older versions.[51] Apple finally stopped using Bash in its operating systems as default shell with the release of MacOS Catalina in 2019.[52]

Brace expansion[edit]

Brace expansion, also called alternation, is a feature copied from the C shell. It generates a set of alternative combinations. Generated results need not exist as files. The results of each expanded string are not sorted and left to right order is preserved:

$ echo a{p,c,d,b}e
ape ace ade abe
$ echo {a,b,c}{d,e,f}
ad ae af bd be bf cd ce cf

Users should not use brace expansions in portable shell scripts, because the Bourne shell does not produce the same output.

$ # bash shell
$/bin/bash -c 'echo a{p,c,d,b}e'
ape ace ade abe
$ # A traditional shell does not produce the same output
$ /bin/sh -c 'echo a{p,c,d,b}e'
a{p,c,d,b}e

When brace expansion is combined with wildcards, the braces are expanded first, and then the resulting wildcards are substituted normally. Hence, a listing of JPEG and PNG images in the current directory could be obtained using:

ls *.{jpg,jpeg,png}    # expands to *.jpg *.jpeg *.png - after which,
                       # the wildcards are processed
echo *.{png,jp{e,}g}   # echo just shows the expansions -
                       # and braces in braces are possible.

In addition to alternation, brace expansion can be used for sequential ranges between two integers or characters separated by double dots. Newer versions of Bash allow a third integer to specify the increment.

$ echo {1..10}
1 2 3 4 5 6 7 8 9 10
$ echo {01..10}
01 02 03 04 05 06 07 08 09 10
$ echo file{1..4}.txt
file1.txt file2.txt file3.txt file4.txt
$ echo {a..e}
a b c d e
$ echo {1..10..3}
1 4 7 10
$ echo {a..j..3}
a d g j

When brace expansion is combined with variable expansion (A.K.A. parameter expansion and parameter substitution) the variable expansion is performed after the brace expansion, which in some cases may necessitate the use of the eval built-in, thus:

$ start=1; end=10
$ echo {$start..$end} # fails to expand due to the evaluation order
{1..10}
$ eval echo {$start..$end} # variable expansion occurs then resulting string is evaluated
1 2 3 4 5 6 7 8 9 10

Startup scripts[edit]

When Bash starts, it executes the commands in a variety of dot files. Unlike Bash shell scripts, dot files do typically have neither the execute permission enabled nor an interpreter directive like #!/bin/bash.

Legacy-compatible Bash startup example[edit]

The example ~/.bash_profile below is compatible with the Bourne shell and gives semantics similar to csh for the ~/.bashrc and ~/.bash_login. The [ -r filename ] && cmd is a short-circuit evaluation that tests if filename exists and is readable, skipping the part after the && if it is not.

[ -r ~/.profile ] && . ~/.profile             # set up environment, once, Bourne-sh syntax only
if [ -n "$PS1" ] ; then                       # are we interactive?
   [ -r ~/.bashrc     ] && . ~/.bashrc        # tty/prompt/function setup for interactive shells
   [ -r ~/.bash_login ] && . ~/.bash_login    # any at-login tasks for login shell only
fi                                            # End of "if" block

Operating system issues in Bash startup[edit]

Some versions of Unix and Linux contain Bash system startup scripts, generally under the /etc directory. Bash executes these files as part of its standard initialization, but other startup files can read them in a different order than the documented Bash startup sequence. The default content of the root user's files may also have issues, as well as the skeleton files the system provides to new user accounts upon setup. The startup scripts that launch the X window system may also do surprising things with the user's Bash startup scripts in an attempt to set up user-environment variables before launching the window manager. These issues can often be addressed using a ~/.xsession or ~/.xprofile file to read the ~/.profile — which provides the environment variables that Bash shell windows spawned from the window manager need, such as xterm or Gnome Terminal.

Portability[edit]

Invoking Bash with the --posix option or stating set -o posix in a script causes Bash to conform very closely to the POSIX 1003.2 standard.[53] Bash shell scripts intended for portability should take into account at least the POSIX shell standard. Some bash features not found in POSIX are:[53][54]

  • Certain extended invocation options
  • Brace expansion
  • Arrays and associative arrays
  • The double bracket [[...]] extended test construct and its regex matching
  • The double-parentheses arithmetic-evaluation construct (only (( ... )); $(( ... )) is POSIX)
  • Certain string-manipulation operations in parameter expansion
  • local for scoped variables
  • Process substitution
  • Bash-specific builtins
  • Coprocesses
  • $EPOCHSECONDS and $EPOCHREALTIME variables [55]

If a piece of code uses such a feature, it is called a "bashism" – a problem for portable use. Debian's checkbashisms and Vidar Holen's shellcheck can be used to make sure that a script does not contain these parts.[56][57] The list varies depending on the actual target shell: Debian's policy allows some extensions in their scripts (as they are in the dash shell),[54] while a script intending to support pre-POSIX Bourne shells, like autoconf's configure, are even more limited in the features they can use.[58]

Keyboard shortcuts[edit]

Bash uses GNU Readline to provide keyboard shortcuts for command line editing using the default (Emacs) key bindings. Vi-bindings can be enabled by running set -o vi.[59]

Process management (Job control)[edit]

The Bash shell has two modes of execution for commands: batch (asynchronous), and concurrent (synchronous).

To execute commands in batch mode (i.e., in sequence) they must be separated by the character ";", or on separate lines:

command1; command2
command3

In this example, when command1 is finished, command2 is executed, and when command2 has completed, command3 will execute.

A background execution of command1 can occur using (symbol &) at the end of an execution command, and process will be executed in background while returning immediately control to the shell and allowing continued execution of commands.

command1 &

Or to have a concurrent execution of two command1 and command2, they must be executed in the Bash shell in the following way:

command1 & command2

In this case command1 is executed in the background & symbol, returning immediately control to the shell that executes command2 in the foreground.

A process can be stopped and control returned to bash by typing Ctrl+z while the process is running in the foreground.[60]

A list of all processes, both in the background and stopped, can be achieved by running jobs:

$ jobs
[1]-  Running                  command1 &
[2]+  Stopped                  command2

In the output, the number in brackets refers to the job id. The plus sign signifies the default process for bg and fg. The text "Running" and "Stopped" refer to the process state. The last string is the command that started the process.

The state of a process can be changed using various commands. The fg command brings a process to the foreground, while bg sets a stopped process running in the background. bg and fg can take a job id as their first argument, to specify the process to act on. Without one, they use the default process, identified by a plus sign in the output of jobs. The kill command can be used to end a process prematurely, by sending it a signal. The job id must be specified after a percent sign:

kill %1

Conditional execution[edit]

Bash supplies "conditional execution" command separators that make execution of a command contingent on the exit code set by a precedent command. For example:

cd "$SOMEWHERE" && ./do_something || echo "An error occurred" >&2

Where ./do_something is only executed if the cd (change directory) command was "successful" (returned an exit status of zero) and the echo command would only be executed if either the cd or the ./do_something command return an "error" (non-zero exit status).

For all commands the exit status is stored in the special variable $?. Bash also supports if ...;then ...;else ...;fi and case $VARIABLE in $pattern)...;;$other_pattern)...;; esac forms of conditional command evaluation.

Bug reporting[edit]

An external command called bashbug reports Bash shell bugs. When the command is invoked, it brings up the user's default editor with a form to fill in. The form is mailed to the Bash maintainers (or optionally to other email addresses).[61][62]

Programmable completion[edit]

Bash supports programmable completion via built-in complete, compopt, and compgen commands.[63] The feature has been available since the beta version of 2.04 released in 2000.[64][65] These commands enable complex and intelligent completion specification for commands (i.e. installed programs), functions, variables, and filenames.[66]

The complete and compopt two commands specify how arguments of some available commands or options are going to be listed in the readline input. As of version 5.1 completion of the command or the option is usually activated by the Tab ↹ keystroke after typing its name.[66]

Program name[edit]

The program's name is a figure of speech or witticism which begins with an homage to Stephen Bourne, the creator of one of the shell programs which have sometimes been considered superseded by the bash shell. His name is used as a pun on the image of childbirth. With that pun, it would seem, is added an allusion: possibly to the Hindu or Buddhist idea of reincarnation; possibly to the Christian idiom known as "being born again;" or quite possibly just to the more abstract idea of renewal. While numerous English translations of the Christian New Testament, Book of John, chapter 3 do contain the words "born again," Merriam-Webster's dictionary has "born-again" defined as a "...person who has made a renewed or confirmed commitment....[67]" Whatever the original touchstone may have been, in the end the program received the name, "the Bourne Again SHell."[68][69]

The acronym of that name then is "bash," a word meaning "to strike violently.[70]" In the context of computer programming, to "violently hit something," such as a computer keyboard, could be considered a hyperbolic image of some frustration. Such imagery of negative emotionality could be seen as standing in direct juxtaposition to the idea of becoming "born again."

The naming could be considered an instance of verbal irony[71] or accidental innuendo.[72] Bash grammar was initially based on the grammars of the most popular Unix shell programs then currently in use, some of which were considered particularly difficult to use or frustrating at that time. As the years progressed, bash development has made its grammar more user-friendly,[73][74][75][76][77][78] so much so that it seems likely that the bash project has been committed to improving its usablilty. Since then, bash has become the de facto default shell program in most Linux and Unix operating systems.

Documentation[edit]

As the standard upon which bash is based, the POSIX, or IEEE Std 1003.1,[79] et seq, is informative.

The Linux man page[80][81] is intended to be the authoritative explanatory document for the understanding of how `bash` operates, while the GNU manual is sometimes considered more user-friendly for reading. "You may also find information about Bash by running info bash ... or by looking at /usr/share/doc/bash/, /usr/local/share/doc/bash/, or similar directories on your system. A brief summary is available by running bash --help.[68]"

On modern Linuxes, information on shell built-in commands can be found by executing help, help [built-in name]or `man builtins` at a terminal prompt where bash is installed. Some commands, such as `echo`, `false`, `kill`, `printf`, `test` or `true`, depending on your system and on your locally installed version of bash, can refer to either a shell built-in or a system binary executable file. When one of these command name collisions occurs, bash will by default execute a given command line using the shell built-in. Specifying a binary executable's absolute path (i.e., `/bin/printf`) is one way of ensuring that the shell uses a system binary. This name collision issue also effects any "help summaries" viewed with `kill --help` and `/bin/kill --help`. Shell built-ins and system binary executable files of the same name often have differing options.

"The project maintainer also has a Bash page which includes Frequently Asked Questions",[82][83][68] this FAQ is current as of bash version 5.1 and is no longer updated.

Vulnerabilities[edit]

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

Licensing[edit]

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

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

0.99? to 1.05?: GPL-1.0-or-later [90] [49] [91]

Versions[edit]

A version is also available for Windows 10 and Windows 11 via the Windows Subsystem for Linux.[92][93] It is also the default user shell in Solaris 11.[94] Bash was also the default shell in BeOS,[13] and in versions of Apple macOS from 10.3 (originally, the default shell was tcsh) to 10.15 (macOS Catalina), which changed the default shell to zsh,[30] although Bash remains available as an alternative shell.[52]

Release history[edit]

Version Release date Release notes
bash-5.2.15 2022-12-13 NEWS
bash-5.2 2022-09-26
bash-5.1 2020-12-07 github version history NEWS [49]
bash-5.0 2019-01-07 [95][96][97]
bash-5.0-rc1 2018-12-20
bash-5.0-beta2 2018-11-28
bash-5.0-beta 2018-09-17
bash-5.0-alpha 2018-05-22
bash-4.4 2016-09-15 github version history NEWS v4.4
bash-4.4-rc2 2016-08-22
bash-4.4-rc1 2016-02-24
bash-4.4-beta2 2016-07-11
bash-4.4-beta 2015-10-12
bash-4.3 2014-02-26
bash-4.2 2011-02-13
bash-4.1 2009-12-31
bash-4.0 2009-02-20
bash-4.0-rc1 2009-01-12
bash-3.2 2006-10-11
bash-3.1 2005-12-08
bash-3.0 2004-08-03
bash-2.05b 2002-07-17
bash-2.05a 2001-11-16
bash-2.05 2001-04-09
bash-2.04 2000-03-21
bash-2.03 1999-02-19
bash-2.02 1998-04-18
bash-2.01 1997-06-05
bash-2.0 1996-12-31

See also[edit]

References[edit]

  1. ^ "bash-5.2.21.tar.gz". 9 November 2023. Retrieved 9 November 2023.
  2. ^ "Front Page — Free Software Foundation — working together for free software". www.fsf.org.
  3. ^ "Software- GNU Project - Free Software Foundation".
  4. ^ "Bash - GNU Project - Free Software Foundation".
  5. ^ a b c Richard Stallman (forwarded with comments by Chet Ramey) (February 10, 1988). "GNU + BSD = ?". Newsgroupcomp.unix.questions. Usenet: 2362@mandrill.CWRU.Edu. Archived from the original on December 28, 2021. Retrieved December 28, 2021. For a year and a half, the GNU shell was "just about done". The author made repeated promises to deliver what he had done, and never kept them. Finally I could no longer believe he would ever deliver anything. So Foundation staff member Brian Fox is now implementing an imitation of the Bourne shell.
  6. ^ Hamilton, Naomi (May 30, 2008), "The A-Z of Programming Languages: BASH/Bourne-Again Shell", Computerworld: 2, archived from the original on July 6, 2011, retrieved March 21, 2011, When Richard Stallman decided to create a full replacement for the then-encumbered Unix systems, he knew that he would eventually have to have replacements for all of the common utilities, especially the standard shell, and those replacements would have to have acceptable licensing. Original computerworld.com.au link is dead: see also copies of original material at readthedocs.io, computerworld.com.au and the University of South Carolina.
  7. ^ a b Brian Fox (forwarded by Leonard H. Tower Jr.) (June 8, 1989). "Bash is in beta release!". Newsgroupgnu.announce. Archived from the original on May 4, 2013. Retrieved October 28, 2010.
  8. ^ "I Almost Get a Linux Editor and Compiler". Dr. Dobb's. Archived from the original on March 2, 2021. Retrieved 2020-09-12.
  9. ^ Richard Stallman (November 12, 2010). "About the GNU Project". Free Software Foundation. Archived from the original on April 24, 2011. Retrieved March 13, 2011. "Bourne Again Shell" is a play on the name Bourne Shell, which was the usual shell on Unix.
  10. ^ Gattol, Markus (March 13, 2011), Bourne-again Shell, archived from the original on March 9, 2011, retrieved March 13, 2011, The name is a pun on the name of the Bourne shell (sh), an early and important Unix shell written by Stephen Bourne and distributed with Version 7 Unix circa 1978, and the concept of being "born again".
  11. ^ Torvalds, Linus Benedict (August 1991). "comp.os.minix". Retrieved 2009-09-06. I've currently ported bash(1.08) and gcc(1.40), and things seem to work.
  12. ^ "Bash FAQ, version 4.14". Archived from the original on September 1, 2018. Retrieved April 9, 2016.
  13. ^ a b "A desktop alternative". Forbes.
  14. ^ "Appendix A: Using the BeOS Command Line Shell". testou.free.fr.
  15. ^ "Terminal".
  16. ^ Brian Fox (August 29, 1996), shell.c, Free Software Foundation, archived from the original on September 28, 2018, retrieved November 1, 2010, Birthdate: Sunday, January 10th, 1988. Initial author: Brian Fox
  17. ^ Richard Stallman (3 October 2010). "About the GNU Project". Free Software Foundation. Archived from the original on April 24, 2011. Retrieved 21 March 2011. Free Software Foundation employees have written and maintained a number of GNU software packages. Two notable ones are the C library and the shell. ... We funded development of these programs because the GNU Project was not just about tools or a development environment. Our goal was a complete operating system, and these programs were needed for that goal.
  18. ^ len (g...@prep.ai.mit.edu) (April 20, 1993). "January 1993 GNU's Bulletin". Newsgroupgnu.announce. Usenet: gnusenet930421bulletin@prep.ai.mit.edu. Archived from the original on March 2, 2021. Retrieved October 28, 2010.
  19. ^ Ramey, Chet (August 1, 1994). "Bash - the GNU shell (Reflections and Lessons Learned)". Linux Journal. Archived from the original on December 5, 2008. Retrieved November 13, 2008.
  20. ^ Chet Ramey (October 31, 2010), Dates in your Computerworld interview, archived from the original on July 20, 2012, retrieved October 31, 2010
  21. ^ Hamilton, Naomi (30 March 2008). "The A-Z of Programming Languages: BASH/Bourne-Again Shell". Computerworld. Archived from the original on 8 November 2016. Retrieved 1 March 2022.
  22. ^ Ramey, Chet (2021-04-20). "The GNU Bourne-Again Shell". Technology Infrastructure Services. Case Western Reserve University. Retrieved 1 March 2022.
  23. ^ Chet Ramey (June 12, 1989). "Bash 0.99 fixes & improvements". Newsgroupgnu.bash.bug. Archived from the original on November 10, 2012. Retrieved November 1, 2010.
  24. ^ Chet Ramey (July 24, 1989). "Some bash-1.02 fixes". Newsgroupgnu.bash.bug. Archived from the original on November 10, 2012. Retrieved October 30, 2010.
  25. ^ Brian Fox (March 2, 1990). "Availability of bash 1.05". Newsgroupgnu.bash.bug. Archived from the original on November 10, 2012. Retrieved October 30, 2010.
  26. ^ Bresnahan, Christine; Blum, Richard (April 2015). CompTIA Linux+ Powered by Linux Professional Institute Study Guide: Exam LX0-103 and Exam LX0-104 (3rd ed.). John Wiley & Sons, Inc. p. 5. ISBN 978-1-119-02122-3. Archived from the original on March 2, 2021. Retrieved June 6, 2016. In Linux, most users run bash because it is the most popular shell.
  27. ^ Danesh, Arman; Jang, Michael (February 2006). Mastering Linux. John Wiley & Sons, Inc. p. 363. ISBN 978-0-7821-5277-7. Archived from the original on March 2, 2021. Retrieved June 6, 2016. The Bourne Again Shell (bash) is the most common shell installed with Linux distributions.
  28. ^ Foster-Johnson, Eric; Welch, John C.; Anderson, Micah (April 2005). Beginning Shell Scripting. John Wiley & Sons, Inc. p. 6. ISBN 978-0-7645-9791-6. Archived from the original on March 2, 2021. Retrieved June 6, 2016. Bash is by far the most popular shell and forms the default shell on Linux and Mac OSX systems.
  29. ^ "Use zsh as the default shell on your Mac - Apple Support". Archived from the original on December 2, 2019. Retrieved 1 July 2019.
  30. ^ a b Warren, Tom (June 4, 2019). "Apple replaces bash with zsh as the default shell in macOS Catalina". The Verge. Archived from the original on June 10, 2019. Retrieved June 13, 2019.
  31. ^ "Missing source code - GPL compliance? · Issue #107 · Microsoft/WSL". GitHub. Archived from the original on September 24, 2019. Retrieved July 8, 2016.
  32. ^ "GNU Bash". Softpedia. SoftNews. January 23, 2010. Archived from the original on October 21, 2017. Retrieved 9 April 2016.
  33. ^ "Installing the new GNV packages". Archived from the original on October 3, 2020. Retrieved 2020-09-04.
  34. ^ "Compatibility Subsystems". Archived from the original on September 23, 2020. Retrieved 2020-09-04.
  35. ^ Juliana, Cino (10 June 2017). "Linux bash exit status and how to set exit status in bash - Techolac". Archived from the original on June 21, 2019. Retrieved 21 June 2019.
  36. ^ Huzaifa Sidhpurwala (2014-09-24). "Bash specially-crafted environment variables code injection attack". Red Hat. Archived from the original on September 25, 2014. Retrieved September 25, 2014.
  37. ^ "Command Execution Environment (Bash Reference Manual)". www.gnu.org.
  38. ^ "Brace Expansion (Bash Reference Manual)". www.gnu.org. Retrieved 2024-01-10.
  39. ^ "Bash Reference Manual". www.gnu.org. Archived from the original on March 15, 2018. Retrieved March 27, 2018.
  40. ^ "Debugging Bash scripts". tldp.org. Archived from the original on November 4, 2018. Retrieved November 20, 2018.
  41. ^ "The Set Builtin (Bash Reference Manual)". www.gnu.org. Retrieved 2024-01-10.
  42. ^ "Bash changes [Bash Hackers Wiki (DEV 20200708T2203)]". wiki-dev.bash-hackers.org. Archived from the original on September 23, 2019. Retrieved September 23, 2019.
  43. ^ "Bourne Shell Builtins (Bash Reference Manual)". www.gnu.org. Retrieved 2024-01-10.
  44. ^ "Bash Reference Manual". www.gnu.org. Archived from the original on September 15, 2019. Retrieved September 15, 2019.
  45. ^ "Working more productively with bash 2.x/3.x". www.caliban.org. Archived from the original on June 29, 2018. Retrieved June 21, 2018.
  46. ^ "6.11 Bash POSIX Mode", The GNU Bash Reference Manual, for Bash, Version 4.1, December 23, 2009, archived from the original on December 3, 2010, retrieved October 26, 2010
  47. ^ "Advanced Bash-Scripting Guide". www.tldp.org. Section 37.2 (Bash, version 3). Archived from the original on May 5, 2017. Retrieved 2017-03-05.
  48. ^ "Bash, version 4". tldp.org. Archived from the original on July 1, 2018. Retrieved June 25, 2018.
  49. ^ a b c "BashFAQ/061 - Greg's Wiki". mywiki.wooledge.org. Archived from the original on March 2, 2021. Retrieved 2021-03-01.
  50. ^ "Arrays (Bash Reference Manual)". www.gnu.org. Archived from the original on July 11, 2018. Retrieved July 4, 2018.
  51. ^ "macos - Update bash to version 4.0 on OSX". Ask Different. Archived from the original on June 25, 2018. Retrieved June 25, 2018.
  52. ^ a b Hughes, Matthew (2019-06-04). "Why does macOS Catalina use Zsh instead of Bash? Licensing". The Next Web. Archived from the original on December 31, 2020. Retrieved 2021-01-12.
  53. ^ a b Mendel Cooper. "Portability Issues". The Linux Documentation Project. ibiblio.org. Archived from the original on January 27, 2012. Retrieved January 26, 2012.
  54. ^ a b "10. Files". Debian Policy Manual v4.5.0.2. Archived from the original on May 12, 2020. Retrieved May 11, 2020.
  55. ^ "How To Format Date And Time In Linux, MacOS, And Bash?". Shell Tips!. Archived from the original on June 3, 2020. Retrieved June 3, 2020.
  56. ^ checkbashisms(1) – Linux General Commands Manual
  57. ^ shellcheck(1) – Linux General Commands Manual
  58. ^ "Portable Shell". Autoconf. Archived from the original on March 2, 2021. Retrieved 20 January 2020.
  59. ^ "BASH Help - A Bash Tutorial". Hypexr.org. October 5, 2012. Archived from the original on March 2, 2021. Retrieved July 21, 2013.
  60. ^ "Bash Reference Manual". www.gnu.org. Archived from the original on March 15, 2018. Retrieved March 27, 2018.
  61. ^ bashbug(1) Archived October 2, 2018, at the Wayback Machine, die.net
  62. ^ "Linux / Unix Command: bashbug" Archived October 6, 2014, at the Wayback Machine, apple.com
  63. ^ "Bash Reference Manual". tiswww.case.edu.
  64. ^ "Working more productively with bash 2.x/3.x". www.caliban.org. Archived from the original on June 29, 2018. Retrieved June 21, 2018.
  65. ^ "Index of /gnu/bash". ftp.swin.edu.au. Archived from the original on March 8, 2020. Retrieved September 15, 2019.
  66. ^ a b "An Introduction to Programmable Completion". tldp.org. Retrieved 2022-01-21.
  67. ^ "Definition of BORN-AGAIN". www.merriam-webster.com. Retrieved 2024-01-09.
  68. ^ a b c "Bash - GNU Project - Free Software Foundation". www.gnu.org. Retrieved 2024-01-10.
  69. ^ "What is Bash? (Bash Reference Manual)". www.gnu.org. Retrieved 2024-01-09.
  70. ^ "Definition of BASH". www.merriam-webster.com. 2024-01-05. Retrieved 2024-01-09.
  71. ^ "Irony Definition, Common Examples, and Significance in Literature". August 31, 2020.
  72. ^ "Innuendo - Examples and Definition of Innuendo". January 2, 2014.
  73. ^ "BashGuide/Arrays - Greg's Wiki". mywiki.wooledge.org. Retrieved 2024-01-10.
  74. ^ "CommandSubstitution - Greg's Wiki". mywiki.wooledge.org. Retrieved 2024-01-10.
  75. ^ "BashGuide/TestsAndConditionals - Greg's Wiki". mywiki.wooledge.org. Retrieved 2024-01-10.
  76. ^ "CHANGES - bash.git - bash". git.savannah.gnu.org. Retrieved 2024-01-10.
  77. ^ "Bash changes [Bash Hackers Wiki]". 2021-02-14. Archived from the original on February 14, 2021. Retrieved 2024-01-10.
  78. ^ "Obsolete and deprecated syntax [Bash Hackers Wiki]". 2021-02-11. Archived from the original on February 11, 2021. Retrieved 2024-01-10.
  79. ^ "The Open Group Base Specifications Issue 7, 2018 edition". pubs.opengroup.org.
  80. ^ "BASH(1) Manual Page". tiswww.case.edu.
  81. ^ "bash.0\doc - bash.git - bash". git.savannah.gnu.org.
  82. ^ "The GNU Bourne-Again Shell". tiswww.case.edu.
  83. ^ "Frequently Asked Questions".
  84. ^ Chazelas, Stephane (4 October 2014). "oss-sec mailing list archives". Seclists.org. Archived from the original on October 6, 2014. Retrieved 4 October 2014.
  85. ^ Leyden, John (September 24, 2014). "Patch Bash NOW: 'Shell Shock' bug blasts OS X, Linux systems wide open". The Register. Archived from the original on October 16, 2014. Retrieved September 25, 2014.
  86. ^ Perlroth, Nicole (September 25, 2014). "Security Experts Expect 'Shellshock' Software Bug in Bash to Be Significant". The New York Times. Archived from the original on April 5, 2019. Retrieved September 25, 2014.
  87. ^ Seltzer, Larry (29 September 2014). "Shellshock makes Heartbleed look insignificant". ZDNet. Archived from the original on May 14, 2016.
  88. ^ GNU Project. "README file". Archived from the original on April 26, 2019. Retrieved April 16, 2014. Bash is free software, distributed under the terms of the [GNU] General Public License as published by the Free Software Foundation, version 3 of the License (or any later version).
  89. ^ "bash-1.11". oldlinux.org. Archived from the original on October 15, 2021. Retrieved June 9, 2021. See test.c for GPL-2.0-or-later
  90. ^ "bash-1.05.tar". oldlinux.org.
  91. ^ "Is there a way to download the presumably initial bash source bash-0.99?". unix.stackexchange.com.
  92. ^ "How to install Bash shell command-line tool on Windows 10". September 28, 2016. Archived from the original on November 20, 2016. Retrieved November 20, 2016.
  93. ^ Hoffman, Chris (July 30, 2021). "How to Install the Windows Subsystem for Linux on Windows 11". How-To Geek. Retrieved 2022-10-12.
  94. ^ "User Environment Feature Changes". Oracle. Archived from the original on June 12, 2018. Retrieved June 8, 2018.
  95. ^ "github version history NEWS v5.0". GitHub. Archived from the original on May 4, 2022. Retrieved 2021-03-01.
  96. ^ "Bash changes [Bash Hackers Wiki]". Archived from the original on March 18, 2020. Retrieved November 25, 2019.
  97. ^ "Bash-5.0 release available". lists.gnu.org. Archived from the original on November 8, 2020. Retrieved 2021-03-01.

External links[edit]