I am trying to get input parameters for my bash script. testbash.sh 4 1 2 4 5 Science a p * I want to get these arguments as an array which i used $@ to acquire all of it into a array. Now based on the first argument i need to subset the rest. Here the first number is 4 so from second argument to fifth argument should be saved as an array like [1 2 4 5] and the rest of the arguments in another array.
I tried this
array=( $@ )
len=${#array[@]}
args=${array[@]:0:$len-${array[1]}}
echo $args
I tried this to get the first part but i get error syntax error in expression (error token is ":-4") when i ran this "testbash.sh 4 1 2 4 5 Science a p * "