If I have a bash function with two or more params, and the first is an array, how can I access the second param?
It's the same as this question but the non-array param is the first argument there, while mine is not (so it does not answer my question).
function getParam() {
   arr=("$@")
   for i in "${arr[@]}";
   do
      echo $i #works - print array item
   done
   var=$2
   echo $var #not working - returns two; I want 3
}
array=('one' 'two' 'three')
getParam "${array[@]}" 3
 
     
     
    