2019-06-02 08:35:02 +00:00
|
|
|
# usage
|
|
|
|
source ./parseargs.sh
|
2019-06-02 09:18:03 +00:00
|
|
|
MY_ARGS="foo 'bar baz' qux * "'$(dangerous)'" sudo ls -lah"
|
|
|
|
IFS=$'\r\n' GLOBIGNORE='*' args=($(parseargs "$MY_ARGS"))
|
2019-06-02 08:35:02 +00:00
|
|
|
echo '$@': "${args[@]}"
|
|
|
|
for arg in "${args[@]}"; do
|
|
|
|
echo "$arg"
|
|
|
|
done
|