home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d8xx / d811 / bsh.lha / bsh / push < prev    next >
Text File  |  1993-02-14  |  835b  |  28 lines

  1. # push - change directory, keeping the current directory on a stack so
  2. # that you can return to it later (see pop).  If no directory stack exists
  3. # push creates one of depth 10 (see the line: array Push_dirs[10]).
  4. #
  5. # Push is presented as is; no warrantee is either expressed or implied
  6. # as to it's suitability to any purpose whatsoever.  You assume all the
  7. # risk for all damage, even if caused by a defect in the software,
  8. # no matter how awful.
  9. if #argv != 2
  10.     echo "usage: push dir"
  11.     return 0
  12. elseif !?Dir_stack || !?Push_dirs
  13.     array Push_dirs[10]
  14.     set Dir_stack 0
  15.     if ?_debug
  16.     echo initializing directory stack - depth: $#Push_dirs
  17.     endif
  18. elseif Dir_stack>=#Push_dirs
  19.     echo "Directory stack full"
  20.     return 10
  21. endif
  22. local here=cwd
  23. cd $argv[1]
  24. if status==0
  25.     Push_dirs[Dir_stack]=here
  26.     Dir_stack++
  27. endif
  28.