some links on bash and optional parameters
Posted by jpluimers on 2019/11/26
Hopefully I’ve been able to integrate some of the ideas in the links below in github.com/jpluimers/btrfs-du/blob/master/btrfs-du
One of the features I wanted there was to be able to add optional switches like --raw, --iec or --si to it similar to what as the btrfs qgroup show subcommand has.
- [WayBack] BashFAQ/035 – Greg’s Wiki: How can I handle command-line options and arguments in my script easily?
- via: [WayBack] Answer to: How do I parse optional arguments in a bash script if no order is given? – Unix & Linux Stack Exchange that mentions “This article shows two different ways – shift and getopts (and discusses the advantages and disadvantages of the two approaches).” Thanks Robert / John N
- [WayBack] Security implications of forgetting to quote a variable in bash/POSIX shells – Unix & Linux Stack Exchange
- [WayBack] Answer to: Security implications of forgetting to quote a variable in bash/POSIX shells – Unix & Linux Stack Exchange
- [WayBack] shell script – search contents of files that are packed in a zip file – Unix & Linux Stack Exchange
- [WayBack] Answer to: shell script – search contents of files that are packed in a zip file – Unix & Linux Stack Exchange
It seems possible with bash, but it is not trivial, at least not for me as a non-frequent bash user, so here are some links to get me started:
In retrospect, other languages than bash might have been a better choice for a script like that (:
–jeroen
PS, some btrfs references:






Leave a comment