Store args passed in array but not the first 2 args.
# bash
declare -a arr=("$@")
s=$(IFS=, eval 'echo "${arr[*]}"')
echo "$s"
output:
sh array.sh 1 2 3 4 5 6
1,2,3,4,5,6
Desired output:
sh array.sh 1 2 3 4 5 6
3,4,5,6
Store args passed in array but not the first 2 args.
# bash
declare -a arr=("$@")
s=$(IFS=, eval 'echo "${arr[*]}"')
echo "$s"
output:
sh array.sh 1 2 3 4 5 6
1,2,3,4,5,6
Desired output:
sh array.sh 1 2 3 4 5 6
3,4,5,6
declare -a arr=("$@")
s=$(IFS=, eval 'echo "${arr[*]:(+2)}"')
echo "$s"
sh array.sh 1 2 3 4 5 6
3,4,5,6
#!/bin/bash
shift 2
arr=( $* )
echo ${arr[*]}
user@Imperfecto_:~$ ./run 1 2 3 4 5 6
3 4 5 6
--ahamed