Ravi Sir's Cards › AWS
getopts vs while/case
This comparison card contrasts getopts and while/case. getopts is described as built in, short flags. while/case is described as hand-written loop. The card pairs getopts with small tools, and while/case with rich CLIs.
Read card text
What this card says
Parse
getopts
Built in, short flags.
while/case
Hand-written loop.
Key points
-v -f file, joined -vf.
Long --flags too.
Example
while getopts 'vf:' o
Use when
Small tools.
Rich CLIs.