- local rev2=$2
- if [[ -z ${rev2} ]] ; then
- rev2=$(
- cd ${dir}
- export IFS=/
- set -- $(grep /${file}/ CVS/Entries)
- unset IFS
- echo $3
- )
- if [[ ${rev2} == "0" ]] ; then
- # new file
- rev2="1.1"
- else
- # existing file, bump rev automatically
- rev2="1.$((${rev2#1.}+1))"
+ if command cd "$@" ; then
+ pushd -n "${PWD}" >/dev/null
+ else
+ local ret=$?
+
+ if [[ $# -gt 1 ]] ; then
+ # The `cd` above should have shown an error message for us.
+ local arg first_arg="$1"
+ while [[ $# -gt 0 ]] ; do
+ arg="$1"
+ shift
+ if [[ -d ${arg} ]] ; then
+ if [[ $# -gt 0 ]] ; then
+ printf 'cd: remaining: %s\n' "$@" >&2
+ fi
+ printf 'cd: entering: %s\n' "${arg}" >&2
+ cd_history "${arg}"
+ return
+ else
+ printf 'cd: skipping: %s\n' "${arg}" >&2
+ fi
+ done
+ # If we're still here, then we didn't cd anywhere.
+ echo "cd: cwd is unchanged!" >&2