home *** CD-ROM | disk | FTP | other *** search
- #!c:sksh
-
- #*************************************************************************
- # The following functions implement directory push and pop operations.
- # The first, pushd, accepts one argument. It cd's to that directory, but
- # pushes the current working directory onto a stack, first, so that it
- # can later be retrieved with a popd.
- #*************************************************************************
-
- if [ "$#" -ne '1' -o "$1" = '-?' ]
- then
- echo 'Usage:' $(basename $0) 'new_dir'
- echo ' (pushes new directory onto directory stack)'
- return 1
- fi
-
- # --- the argument must be a directory we can "cd" to ---------------------
-
- cd "$1" >nil: || echo "$0: Can't cd to $1" && return 1
-
- # --- save off the old working directory in the DIRSTACK ------------------
-
- DIRSTACK="$OLDPWD,$DIRSTACK"
- export -l DIRSTACK
-