Function: insert

Insert element into array at position

USAGE: insert arrayname string position

  local arrayname=${1:?Arrayname required} val=$2 num=${3:-1}
  local array

Copy the array, $arrayname, to local array

  eval "array=( \"\${$arrayname[@]}\" )"

If position is less than 0 set to 0

  [ $num -lt 0 ] && num=0 #? Should this be an error instead?
  array=( "${array[@]:0:num}" "$val" "${array[@]:num}" )

Copy array back to $arrayname

  eval "$arrayname=( \"\${array[@]}\" )"