}
# smart cd function, allows switching to /etc when running 'cd /etc/fstab'
cd() {
- if [[ -f ${1} ]]; then
+ if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then
[[ ! -e ${1:h} ]] && return 1
print "Correcting ${1} to ${1:h}"
builtin cd ${1:h}
else
- builtin cd ${1}
+ builtin cd "$@"
fi
}