home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume7 / dirstack.csh / restdir < prev    next >
Text File  |  1987-01-18  |  649b  |  27 lines

  1. #! /bin/csh -f
  2. #
  3. #    Shell script to restore directory stack (this file should be sourced)
  4. #
  5. #    Author:        Paul Lew, General Systems Group, Inc.
  6. #    Created at:    01/03/86
  7. #    Last update:    10/08/86  05:07 PM
  8. #
  9. if ( $?0 ) then
  10.     echo "...You should source this program, not execute it..."
  11.     goto end
  12.     endif
  13. if ( ! ${?SAVED_WD} ) setenv SAVED_WD ~/saved_wd
  14. if ( ! ${?filename} ) set filename = ${SAVED_WD}/cwd.wd
  15. set _dirlist = `cat ${filename}`
  16. set _dirs
  17. foreach _dir (${_dirlist})            #reverse directory stack
  18.     set _dirs = (${_dir} ${_dirs})
  19.     end
  20. chdir ${_dirs[1]}
  21. shift _dirs
  22. foreach _dir (${_dirs})
  23.     pushd ${_dir} > /dev/null
  24.     end
  25. unset _dirlist _dir _dirs
  26. end:
  27.