Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!husc6!cmcl2!adm!xadmx!SSUCS004@vmd.cso.uiuc.edu From: SSUCS004@vmd.cso.uiuc.edu (Jeff Gustafson) Newsgroups: comp.unix.questions Subject: Re: Getting csh prompt to display the current dir. Message-ID: <18910@adm.BRL.MIL> Date: 3 Apr 89 07:31:17 GMT Sender: news@adm.BRL.MIL Lines: 59 In the INFO-UNIX digest for Tue, 28 Mar 1989 V7#034, lbn@ksuvax1.cis.ksu.edu (Lars Bo Nielsen) wrote: (here come some thickly applied >'s) >In article <2113@cveg.uucp> jms@hcx.uucp (Michael Stanley) writes: >> >>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"% "' >>> [Three more examples] >> >>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. > >You are right. Here are the modified (quicker) versions: And here, Mr. Nielsen gives the results of the suggestions made above. However, I hasten to add that not every version of csh has the $cwd environment variable. I work on a Sperry 5000/90, and the Unisys proprietary version of csh does not have $cwd (nor does it allow the old $< trick, push, and pop). Granted, I am an exception to a general rule, but we're always out there somewhere and must help each other out. (O, woe....) Without the $cwd variable, the foo is a necessity. One can get around the $< problem (if one must) by coding: set instuff = `cat | head -1` (to read exactly one line of input) instead of the old set instuff = $< . For the push and pop utilities, I refer you to "The C-Shell Field Guide" by Gail Anderson and Paul Anderson. It's the best work I've seen covering csh. What irks me so much is that the Sperry manuals explicitly state that $< works. Ah, well... we live and we learn. I also cannot properly use the source command. Does anyone out there have any useful suggestions for a poor user of a brain-dead C-shell? [I say that for the sake of my ego; no doubt I am overlooking something, I'm a "sh" refugee.] Your input shall be most welcome. Jeff Gustafson J-168, Academic Computing Services Sangamon State University Springfield, IL 62794-9243