3 ms·
Like @bxparks, I have a template for my bash scripts command-line parsing, but I like to stick to GNU-style options and I find that Bash's getopts command handl
by databasher 6y ago
Like @bxparks, I have a template for my bash scripts command-line parsing, but I like to stick to GNU-style options and I find that Bash's getopts command handles all these cases without trouble:
command -ffilename -f filename --file=filename -- -f is not an option
My template is at https://gist.github.com/webb/ff380b0eee96dafe1c20c2a136d85ef0 https://gist.github.com/webb/ff380b0eee96dafe1c20c2a136d85ef....
- LukeShu 6y agoUsing `-:` to build long-options on top of the short-option-only `getopts` builtin is a great hack.
- databasher 6y agoThanks!