Bash
A Unix shell and command language that serves as both an interactive command interpreter and a powerful scripting language.
Also known as: Bourne Again Shell
Category: Software Development
Tags: software-engineering, programming
Explanation
Bash (Bourne Again Shell) is a Unix shell and command language created by Brian Fox for the GNU Project in 1989. It has been the default shell on most Linux distributions and was macOS's default shell until Catalina (2019).
Bash functions as both an interactive command interpreter and a scripting language. It combines features from the original Bourne shell (sh) with additions from the Korn shell (ksh) and C shell (csh), making it a versatile tool for system administration and automation.
Key features include POSIX compliance for compatibility with sh scripts, command history navigation, tab completion for files and commands, aliases for command shortcuts, functions for reusable command sequences, support for both indexed and associative arrays, built-in integer arithmetic, and job control for managing background and foreground processes.
Bash scripts use variables (assigned without spaces around =), conditionals (if/elif/else with [[ ]] syntax), loops (for, while), and functions. Configuration files like ~/.bashrc (for interactive non-login shells) and ~/.bash_profile (for login shells) allow users to customize their shell environment with aliases, functions, and environment variables.
Common built-in commands include cd (change directory), pwd (print working directory), echo (print text), export (set environment variables), source (execute script in current shell), alias (create shortcuts), and history (view command history).
Related Concepts
← Back to all concepts