I would expect to get
3 4 5 6
3 4 5 6
but the shifted parameters are still in place :-(
wwalker@serenity:~ ✓ $ ./a.sh 1 2 3 4 5 6
3 4 5 6
1 2 3 4 5 6
I would expect to get
3 4 5 6
3 4 5 6
but the shifted parameters are still in place :-(
wwalker@serenity:~ ✓ $ ./a.sh 1 2 3 4 5 6
3 4 5 6
1 2 3 4 5 6
#!/bin/bash | |
arg_parser(){ | |
shift | |
shift | |
POSITIONAL=() | |
while [[ $# -gt 0 ]] | |
do | |
POSITIONAL+=("$1") | |
shift | |
done | |
echo "${POSITIONAL[@]}" | |
set -- "${POSITIONAL[@]}" | |
} | |
arg_parser "$@" | |
echo "$@" | |