I already know about getopts, and this is fine, but it is annoying that you have to have a flag even for mandatory arguments.
Ideally, I\'d like to be able to have a scr
And I heard a completely opposite thing, that you shouldn't use getopt
, but the getopts
builtin.
Cross-platform getopt for a shell script
Never use getopt(1). getopt cannot handle empty arguments strings, or arguments with embedded whitespace. Please forget that it ever existed.
The POSIX shell (and others) offer getopts which is safe to use instead.