alias to link cd to pwd
Brian V. Smith
envbvs at epb2.lbl.gov
Sat Jun 10 03:29:40 AEST 1989
In article <307 at ohs.UUCP>, mday at ohs.UUCP (Matthew T. Day) writes:
>
> in article <3710 at tank.uchicago.edu>, phd_ivo at 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 at lbl.gov)
Lawrence Berkeley Laboratory
We don't need no signatures!
More information about the Comp.unix.questions
mailing list