alias to link cd to pwd

Matthew T. Day mday at ohs.UUCP
Fri Jun 9 07:16:57 AEST 1989


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.
-- 
+----------------------------------------------------------+-----------------+
| Matthew T. Day, Orem High School, Orem, Utah             | "He who laughs, |
| Internet: mday at ohs.uucp  UUCP: ..!uunet!iconsys!ohs!mday |  lasts."        |
+----------------------------------------------------------+-----------------+



More information about the Comp.unix.questions mailing list