Answers for "bash forward argv to command"

0

bash forward argv to command

# in r.sh
echo "params only 2    : ${@:2:1}"
echo "params 2 and 3   : ${@:2:2}"
echo "params all from 2: ${@:2:99}"
echo "params all from 2: ${@:2}"

# run it:
$ chmod u+x r.sh
$ ./r.sh 1 2 3 4 5 6 7 8 9 10

# result:
params only 2    : 2
params 2 and 3   : 2 3
params all from 2: 2 3 4 5 6 7 8 9 10
params all from 2: 2 3 4 5 6 7 8 9 10
Posted by: Guest on September-13-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language