Csh question: Doing cd .. from a symbolically linked directory
Maarten Litmaath
maart at cs.vu.nl
Sat Oct 27 05:09:31 AEST 1990
Here's a slight improvement; check the output of `cd /'; furthermore
you won't get into trouble if you accidentally type `cd foo/ bar' or
if there is a subdirectory `0' and you type `cd0'.
--------------------cut here--------------------
alias cd 'set tmp=(\!*); eval _cd_$#tmp $cwd \!*//. ../ ~; echo $cwd'
alias _cd_0 'chdir \!$'
alias _cd_1 'if (x\!:2 !~ x../*) set status=1'\
'&& eval _cd_x /\!^:h \!:2-:s-../--'\
'|| chdir \!:2:h'
alias _cd_x 'if (x\!:2 !~ x../*) set status=1'\
'&& eval _cd_x /\!^:h \!:2*:s-../--'\
'|| chdir \!^/\!:2:h'
alias pwd 'echo $cwd'
--------------------cut here--------------------
--
Waiting for this to work: cat /internet/cs.vu.nl/finger/maart
More information about the Comp.unix.shell
mailing list