Skip to main content
4 events
when toggle format what by license comment
Apr 21, 2020 at 22:10 comment added Thomas Guyot-Sionnest By far the best answer yet too many people don't use parameter expansion. This works on arrays too, incl $@: params=("${@##*[!0-9]*}") -- Keep all positional arguments, but only use numbers - anything else will be converted to null string which conveniently evaluates to 0 in arithmetic evaluations (my use case - function parameter is a list of integers, unset or null should default to 0 but caller sets variable name when unset).
Oct 29, 2018 at 11:06 comment added mikeserv OPTIND is good here, too. just saiyan.
Aug 23, 2014 at 4:40 review Low quality posts
Aug 23, 2014 at 4:41
Aug 23, 2014 at 4:23 history answered mikeserv CC BY-SA 3.0