# Listing 3: our edited pushd
#!/bin/ksh

dirname=$1
if [[ -d $dirname && -x $dirname ]]; then
   DIRSTACK="$dirname ${DIRSTACK:-$PWD }"
   cd $dirname
   print "$DIRSTACK"
else
   print "still in $PWD."
fi
# end listing 3

