Skip to main content

Bash

Bourne Again Shell

Pronunciation
BASH
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/bash

In short

Bash is a Unix shell and scripting language, the default on most Linux systems, used both to type commands interactively and to automate tasks with scripts.

What is Bash?

Bash was written by Brian Fox for the GNU Project and released in 1989 as a free replacement for the Bourne shell, which is where the pun in its name comes from. It became the default shell on most Linux distributions and on macOS for many years; macOS switched its default to zsh in 2019, which is largely compatible for everyday use.

As a language, Bash glues programs together. Commands are connected with pipes, grep error app.log | wc -l, their output can be captured in variables with $(...), and scripts add variables, conditions, loops and functions. A script starts with a shebang line such as #!/usr/bin/env bash and is made executable with chmod +x.

That makes Bash the natural tool for automation: build and deploy steps, CI pipelines, container entry points, server setup and small data chores. In the Stack Overflow developer surveys, Bash/Shell regularly ranks among the most used languages, because nearly every developer writes some.

A common misconception is that Bash is fine for programs of any size. Its quoting rules, word splitting and error handling are full of traps: unquoted variables break on spaces in file names, and by default a failing command doesn't stop the script. Quoting every variable, starting with set -euo pipefail, checking scripts with ShellCheck and switching to Python once logic grows complex avoid most problems.

Key takeaways

  • Bash is a Unix shell and scripting language released in 1989.
  • It is the default command line on most Linux systems.
  • Pipes, variables, loops and functions glue programs together.
  • It is the everyday tool for build, deploy and CI automation.
  • Quote variables, use set -euo pipefail and ShellCheck to avoid its traps.

Example

A small, safe Bash scriptbash
#!/usr/bin/env bash
set -euo pipefail          # stop on errors, unset variables and failed pipes

log_dir="${1:-/var/log/myapp}"
threshold=10

count=$(grep -c "ERROR" "$log_dir/app.log" || true)

if (( count > threshold )); then
  echo "Too many errors: $count" >&2
  exit 1
fi

for file in "$log_dir"/*.log; do   # quoted, so spaces in names are safe
  gzip --keep "$file"
done
echo "Archived logs, $count errors found."

Readers ask

What is the difference between Bash and a shell?

A shell is any program that reads commands and runs them. Bash is one specific shell; others include sh, zsh, fish and PowerShell.

Is Bash a programming language?

Yes. It has variables, conditions, loops and functions, so it is a full scripting language, though it is designed for running and combining commands rather than for large applications.

Can I use Bash on Windows?

Yes, through the Windows Subsystem for Linux (WSL), which runs a real Linux environment, or through Git Bash, which comes with Git for Windows.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings