chris@pixutl.UUCP (chris) (11/02/84)
I have seen several pushd/popd for the shell, lately, but they don't behave like the Cshell's. This one looks to the user like the 4.1 version (it doesn't have the '+n' option). ---------- DSTACK='' pushd(){ SAVE=`pwd` DSTACK="$SAVE $DSTACK" if [ "$1" = "" ] ; then if [ "$DSTACK" = "$SAVE " ] ; then echo "pushd: No other directory" DSTACK="" return 1 fi set $DSTACK cd $2 shift shift DSTACK="$SAVE $*" else if (cd $1) ; then cd $1 >&- else popd > /dev/null return 1 fi fi dirs return 0 } popd(){ if [ "$DSTACK" = "" ] ; then echo "popd: Directory stack empty" return 1 fi set $DSTACK cd $1 shift DSTACK=$* dirs return 0 } dirs(){ echo "`pwd` $DSTACK" return 0 } -- Chris Bertin : (617) 657-8720 x2318 Pixel Computer Inc. : 260 Fordham Rd. : {allegra|ihnp4|cbosgd|ima|genrad|amd|harvard}\ Wilmington, Ma 01887 : !wjh12!pixel!pixutl!chris