Skip to content
AgileLogics
4 min read

What Is Bash?

Bash (the "Bourne Again SHell") is a shell: a program that reads the commands you type and runs them. It's also a scripting language — save a list of commands in a file, and Bash runs them for you. Bash was written by Brian Fox for the GNU Project and released in 1989, as a free replacement for the original Unix Bourne shell (sh).

echo "Hello from Bash!"
echo "There are $(printf 'a\nb\nc\n' | wc -l) lines in this list."
Hello from Bash!
There are 3 lines in this list.

Its defining traits:

  • Interactive and scriptable — the same language you type at the prompt is the language you write scripts in.
  • Glue for other programs — Bash's real power is running other programs (grep, sort, curl, git, ...) and connecting them, so small tools combine to do big jobs.
  • Text-based — programs pass plain text to each other through pipes, which makes it easy to chain them.
  • Everywhere — Bash is the default or standard shell on most Linux systems, is available on macOS (whose default interactive shell is now the very similar zsh), and runs on Windows through WSL or Git Bash.

This course targets Bash 5 — the examples were run on Bash 5.3 — and also covers writing portable scripts for plain POSIX sh.