[9] Since its inception, Bash has gained widespread adoption and is commonly used as the default login shell for numerous Linux distributions.
[10] It holds historical significance as one of the earliest programs ported to Linux by Linus Torvalds, alongside the GNU Compiler (GCC).
As a command-line interface (CLI), Bash operates within a terminal emulator, or text window, where users input commands to execute various tasks.
In keeping with Unix shell conventions, Bash incorporates a rich set of features.
The keywords, syntax, dynamically scoped variables, and other basic features of the language are all copied from the Bourne shell, (sh).
"[13] "Christopher Strachey, a British scientist, had visited MIT about that time, and his macro-generator design appeared to me a very solid base for a command language, in particular the techniques for quoting and passing arguments.
Without being invited on the subject, I wrote a paper explaining how the Multics command language could be designed with this objective.
When a user presses the tab key within an interactive command-shell, Bash automatically uses command line completion, since beta version 2.04,[94] to match partly typed program names, filenames and variable names.
Bash can perform integer calculations ("arithmetic evaluation") without spawning external processes.
Bash 3.0 supports in-process regular expression matching using a syntax reminiscent of Perl.
Bash also supports if ...;then ...;else ...;fi and case $VARIABLE in $pattern)...;;$other_pattern)...;; esac forms of conditional command evaluation.
The Bash shell has two modes of execution for commands: batch (asynchronous), and concurrent (synchronous).
Hence, a listing of JPEG and PNG images in the current directory could be obtained using: In addition to alternation, brace expansion can be used for sequential ranges between two integers or characters separated by double dots.
[107] Unlike Bash shell scripts, dot files do typically have neither the execute permission enabled nor an interpreter directive like #!/bin/bash.
Some versions of Unix and Linux contain Bash system startup scripts, generally under the /etc directory.
Bash reads constructs all at once, such as compound commands which include if-fi and case-esac blocks.
If a set -v is included within a compound command, then "verbose" will be enabled the next time Bash reads code as input, ie, after the end of the currently executing construct.
As of version 5.1 completion of the command or the option is usually activated by the Tab ↹ keystroke after typing its name.
[112] Bash uses GNU Readline to provide keyboard shortcuts for command line editing using the default ( Emacs ) key bindings.
The Linux "man page"[115][116] is intended to be the authoritative explanatory technical document for the understanding of how bash operates.
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.
Shell built-ins and system binary executable files of the same name often have differing options.
Running any shell scripts as the root user has, for years, been widely criticized as poor security practice.
However, if the script was executed by the root user, then the command would likely succeed and the filesystem would be erased.
Reliably printing the contents of an array that contains spaces and newlines first in a portable syntax, and then the same thing in Bash.
The bug involved how Bash passed function definitions to subshells through environment variables.
An external command called bashbug reports Bash shell bugs.