Separate a bash script's arguments into options and targets
To get all the arguments that don't start with a hyphen (targets), use:
${@##-*}
To get all the arguments that do start with a hyphen (options), use:
${@##[^\-]*}
Written by Stuart P. Bentley
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Related Tags
#bash
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#