Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!pasteur!helios.ee.lbl.gov!epb2.lbl.gov!envbvs From: envbvs@epb2.lbl.gov (Brian V. Smith) Newsgroups: comp.unix.questions Subject: Re: alias to link cd to pwd Message-ID: <2801@helios.ee.lbl.gov> Date: 9 Jun 89 17:29:40 GMT References: <307@ohs.UUCP> <3710@tank.uchicago.edu> Sender: usenet@helios.ee.lbl.gov Lines: 35 In article <307@ohs.UUCP>, mday@ohs.UUCP (Matthew T. Day) writes: > > in article <3710@tank.uchicago.edu>, phd_ivo@gsbacd.uchicago.edu says: > > A long time ago, I had a script that links a cd to > > reset the prompt to the currently connected directory. > > Here's what I use, and it takes advantage of the built-in $cwd variable in > the Berkeley C-Shell, which drastically decreases the time needed to change > directories. It also uses the 'chdir' alternative to avoid recursive aliases. > The SysV C-Shell that I used didn't have $cwd, so if yours doesn't, simply try > putting backslashes in front of the back "execution" quotes around `pwd`. > > alias sp 'set prompt = "$cwd"\>\ ' > alias cd 'chdir \!^; sp' > > It works great, have fun. No, it doesn't. :-) The trouble with the $cwd variable is that it doesn't know anything about symbolic links (at least on Ultrix, SunOs 3.5, Sunos 4.0.1 or 4.2BSD). So, if you cd to /usr/adm (for example) on a system where that is really a symlink to /usr/var/adm, $cwd will be equal to "/usr/adm", when the path is really "/usr/var/adm." _____________________________________ Brian V. Smith (bvsmith@lbl.gov) Lawrence Berkeley Laboratory We don't need no signatures!