Code-Memo

Shell variables and environment

Overview

Shell scripts use:

Assignments and expansion

name="Alice"
echo "$name"

Parameter expansion essentials

Exporting

API_TOKEN="secret"     # shell variable
export API_TOKEN       # becomes environment variable for children

Common env vars

Sourcing vs executing

Arrays (Bash)

items=("a" "b c" "d")
printf '%s\n' "${items[@]}"

Tips