Getting Started
Arguments
Defaults and Inputs
Scripts read command-line arguments through $1, $2, and related parameter variables. Defaults keep a script useful when callers omit an argument.
Program
Play the no-argument run to watch Bash choose fallback values for user and mode.
arguments.sh
#!/usr/bin/env bash
user="${1:-guest}"
mode="${2:-preview}"
echo "$user:$mode"
positional parameter
`$1` is the first argument passed to a script or function.
default expansion
`${name:-fallback}` uses `fallback` when the variable is unset or empty.