elif [[ $# -ge 2 ]]; then
if [[ -d ${!#} ]]; then
local oldcwd=$PWD
- cd ${!#} # last arg
- for x in "${@:1:$(($#-1))}"; do # all but last arg
+ cd "${!#}" # last arg
+ for x in "${@:1:$(( $# - 1 ))}"; do # all but last arg
# remove any trailing slashes
x="${x%%+(/)}"
# remove any leading directory components