option string
The string given to getopts listing the option letters a script accepts, with a colon after each letter that takes a value.
In more detail
In ":vf:" the v is a flag and f needs a value. The leading colon turns on silent error mode: getopts then reports an unknown option as a question mark and a missing value as a colon, and leaves the messages to you.
Related terms
- getopts — The builtin that parses short command-line options such as -v, -vq and -f value, one option per call, in a while loop.
- OPTARG — The variable getopts fills with the value of an option that takes one, such as the file name after -f.
Taught in
- Option Parsing With getopts — Bash Scripting & Command Line Automation