Small command-line options let callers change behavior without editing the script body.

Program

Play the script to choose an option and see how the interface maps it to a mode.

option_flag.sh
#!/usr/bin/env bash

option=
case "$option" in
    --dry-run) mode="preview" ;;
    --force) mode="apply" ;;
esac
echo "mode=$mode"
#!/usr/bin/env bash

option=
case "$option" in
    --dry-run) mode="preview" ;;
    --force) mode="apply" ;;
esac
echo "mode=$mode"
option A leading-dash option is a compact caller-facing control.
case parse `case` maps recognized options to internal behavior.
mode Using an internal mode word keeps the rest of the script independent of option spelling.