I want indexes of parameters,
and can get it by dummy var:
dummy=( $@ )
echo ${!dummy[@]}
but is there straight way to get them, something like
$!@ ... not working
$!* ... not working
... or something like that?
NOTE: original function that i want to have without arr var is this:
function indexof()
{ search="$1"; shift; arr=( $@ )
for i in "${!arr[@]}"; do [ "$search" == "${arr[$i]}" ] && return $i; done
return -1
}
arr=( $@ )
will split args that contain IFS (by default whitespace); if you didn't dis-want this form entirely you would wantarr=( "$@" )