Bash Quickstart Reference

← Back to quick reference

← Home

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Quick reference guide for Bash. Essential syntax, control flow, variables, arrays, and common patterns for shell scripting.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Hello World

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Variables

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Control Flow

If/Else

For Loops

While Loops

Case Statement

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Functions

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Arrays

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Strings

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Input / Output

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Command Substitution

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

File Operations

File Tests

Reading Files

Writing Files

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Arithmetic

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Error Handling

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Tips

if command -v git &> /dev/null; then

git --version

fi