getopts

Parse script options

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

Parses short options in shell scripts. See the flags and examples below, and run `man getopts` for the full reference.

Examples
while getopts "f:v" opt; do :; doneParse -f value and -v · explain & risk-check →
Related
shift
Open the full explainer →More in Shell & Scripting

Reference text is hand-written and may be incomplete — check man getopts for your version. Test destructive commands on a non-production system first.