for i in $(cut -f 1,3 -d: /etc/passwd)
do
echo "${i#*:}" "${i%:*}"
done
This lets you see what is going on.
is parameter substitution- returns the value just before the colon - a number that is the user id.
returns the username, so:
arr[number] = name
was changed from
which doesn't work, by the way.
Try man (or info) for bash or ksh. This is called parameter substitution using a POSIX shell. It finds substrings.