shiftdoes not delete the last argument, it removes the first. $2becomes $1, $3becomes $2, etc. dwill always be the last argument, because objects fly out in front.
, :
for ((i = $#; i > 0; --i)); do
echo "${!i}"
done
:
while (($# > 0)); do
echo "${@: -1}"
set -- "${@:1:$#-1}"
done
, ${@: -1} ${!#}. . - , Perl script.