Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!sri-unix!hplabs!cae780!amdcad!sun!dlb!plx!titn!herve From: herve@titn.UUCP Newsgroups: comp.unix.wizards Subject: Re: prompt changing on the fly Message-ID: <104@titn.TITN> Date: Fri, 23-Jan-87 18:57:43 EST Article-I.D.: titn.104 Posted: Fri Jan 23 18:57:43 1987 Date-Received: Fri, 30-Jan-87 02:27:11 EST References: <410@moncskermit.oz> Organization: TITN Inc. Hayward, CA Lines: 37 Summary: Prompt changing on the fly. Regarding the prompt setting under csh, here is the way I handle that in my login scripts, for what it's worth (all this on a VAX 750, 4.2): The .login file has the following entries: alias cd 'set old=$cwd; chdir \!*; set prompt = "$Ndirs$cwd> "' alias back 'set back=$old; set old=$cwd; cd $back; unset back' alias ndir "dirs|wc|sed -e 's/^ *1 *//' -e 's/ .*//'" alias push 'pushd \!*; set Ndirs="`ndir` - "; cd .' alias pop 'popd \!*; set Ndirs="`ndir` - "; cd .' set Ndirs = "`ndir` - " cd . The prompt is then the current directory preceded by the number of directories currently on the stack (as I never remember what I'm doing with pushd and popd, that's an information I find quite useful...). The back command allows me to switch between the last two directories I used. I did not put a "set prompt = xxxx" in my .cshrc script. In this case, the standard '%' prompt reminds me, when I see it, that I am in a subshell. For people who heavilly use pushd and popd and who cannot afford the delay in the execution of ndir, just use: alias cd 'set old=$cwd; chdir \!*; set prompt = "$cwd> "' alias back 'set back=$old; set old=$cwd; cd $back; unset back' alias push 'pushd \!*; cd .' alias pop 'popd \!*; cd .' cd . instead of the above, and push and pop will be faster. FROM: Herve Siegrist, TITN Inc. 24301 Southland Dr. Suite 200 Hayward, CA 94545 Tel: (415) 785-5970 UUCP: (decvax|ucbvax|ihnp4)!decwrl!sun!dlb!plx!titn!herve