Path: utzoo!attcan!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.shell Subject: Re: Csh question: Doing cd .. from a symbolically linked directory Message-ID: <8049@star.cs.vu.nl> Date: 25 Oct 90 19:08:23 GMT References: Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Distribution: comp.unix.shell Organization: VU Dept. of Computer Science, Amsterdam, The Netherlands Lines: 26 In article , kivinen@cs.hut.fi (Tero Kivinen) writes: )In article ) jerry@slhisc.uucp (Jerry Liebelson) writes: )> Is there a way to set things in the csh such that when I do the cd .. )> from /tmp/c, I will end up in /tmp and not in /tmp/a? ) )Try alias .. 'cd /$cwd:h' in your .cshrc, and then typing .. works. )This will work in csh or in tcsh. But that doesn't deal nicely with `cd ../../foo/bar'... Following is a solution that does _and_ is completely builtin! Piece of cake right? :-) --------------------cut here-------------------- alias cd 'set tmp=(\!*); eval cd$#tmp $cwd \!*/. ../ ~; echo $cwd' alias cd0 'chdir \!$' alias cd1 'if (x\!:2 !~ x../*) set status=1'\ '&& eval cd2 /\!^:h \!:2-:s-../--'\ '|| chdir \!:2' alias cd2 'if (x\!:2 !~ x../*) set status=1'\ '&& eval cd2 /\!^:h \!:2*:s-../--'\ '|| chdir \!^/\!:2' --------------------cut here-------------------- -- Waiting for this to work: cat /internet/cs.vu.nl/finger/maart