Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!ames!ucsd!rutgers!deimos.cis.ksu.edu!cveg!hcx!jms From: jms@hcx.uucp (Michael Stanley) Newsgroups: comp.unix.questions Subject: Re: Getting UNIX prompt to display curr Summary: Getting the prompt to display the current directory in csh Message-ID: <2113@cveg.uucp> Date: 25 Mar 89 04:21:31 GMT References: <5582@ncsugn.ncsu.edu> <47800029@uxe.cso.uiuc.edu> <1383@deimos.cis.ksu.edu> Sender: netnews@cveg.uucp Organization: College of Engineering, University of Arkansas, Fayetteville Lines: 27 In article <1383@deimos.cis.ksu.edu>, lbn@ksuvax1.cis.ksu.edu (Lars Bo Nielsen) writes: > Simply (in CSH): > > 1) Full pathname: > alias cd 'cd \!*; set foo=`pwd`; set prompt=$foo"% "' > 2) Only name of current dir: > alias cd 'cd \!*; set foo=`pwd`; set prompt=$foo:t"% "' > 3) Include name of machine in prompt > alias cd 'cd \!*; set foo=`pwd`; set prompt=$host":"$foo"% "' > or alias cd 'cd \!*; set foo=`pwd`; set prompt=$host":"$foo:t"% "' Ah, but csh includes the environment variable $cwd. This makes setting foo unnecessary. It seems to me that you could remove the part that says: set foo=`pwd` and replace every occurrence of $foo with $cwd. I haven't actually tested these examples so I hope I didn't just stick my foot in my mouth, but I did do something like this once so I'm pretty sure it'll work. I only make this suggestion because if your system is running slow, every extra binary you run (in this case 'pwd') will just be that much more irritation. Michael Stanley (...!uunet!harris.cis.ksu.edu!jms@hcx)