On Sun, Jul 29, 2012 at 03:04:21PM -0400, Chris F.A. Johnson wrote: > On Sun, 29 Jul 2012, Jason Vas Dias wrote: > > function count_args { v=($@); echo ${#v[@]}; } > > Always quote $@. Without quotes, it's the same as $* > > function count_args { v=( "$@" ); echo ${#v[@]}; }
count_args() { echo $#; } However, if you actually wanted to stuff the function's positional parameters into an array for some other reason, Chris is absolutely correct.