home *** CD-ROM | disk | FTP | other *** search
- # push - change directory, keeping the current directory on a stack so
- # that you can return to it later (see pop). If no directory stack exists
- # push creates one of depth 10 (see the line: array Push_dirs[10]).
- #
- # Push is presented as is; no warrantee is either expressed or implied
- # as to it's suitability to any purpose whatsoever. You assume all the
- # risk for all damage, even if caused by a defect in the software,
- # no matter how awful.
- if #argv != 2
- echo "usage: push dir"
- return 0
- elseif !?Dir_stack || !?Push_dirs
- array Push_dirs[10]
- set Dir_stack 0
- if ?_debug
- echo initializing directory stack - depth: $#Push_dirs
- endif
- elseif Dir_stack>=#Push_dirs
- echo "Directory stack full"
- return 10
- endif
- local here=cwd
- cd $argv[1]
- if status==0
- Push_dirs[Dir_stack]=here
- Dir_stack++
- endif
-