From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,552b7059e033056c X-Google-Attributes: gidfee84,public From: danpop@mail.cern.ch (Dan Pop) Subject: Re: Directory Prompt Date: 1996/05/07 Message-ID: #1/1 X-Deja-AN: 153511263 references: <4lt1oa$294@random.tpgi.com.au> <4mgjpt$obj@northshore.shore.net> <1996May6.165118.16175@isac.hces.com> <4mnec0$r34@glitnir.ifi.uio.no> content-type: text/plain; charset=US-ASCII organization: CERN European Lab for Particle Physics mime-version: 1.0 newsgroups: comp.unix.osf.osf1 In <4mnec0$r34@glitnir.ifi.uio.no> torstenk@ifi.uio.no (Torsten Robert Kirschner) writes: >>>>>> "TMW" == Timothy M Wieman writes: >In article <1996May6.165118.16175@isac.hces.com> timw@isac.hces.com (Timothy M. Wieman) writes: >TMW> Martin Hannigan (hannigan@shore.net) wrote: >>> In article <4lt1oa$294@random.tpgi.com.au>, >>> dhinkle wrote: >>> >Does anyone know how to make the c shell display the current directory >>> >in the prompt, and change the prompt as you change directories. > >>> I think you have to use 'bash' to be able to accomplish that. > >TMW> Sorry I don't know about csh, but you don't have to have 'bash'; >TMW> ksh, tcsh, and I'm sure others support it. > >Tim is right. Just put this in your ~/.cshrc file: > >set myhost=`expr $HOST : '\([^.]*\).*'` >alias setprompt 'set prompt="$myhost `dirs` > "' ^^^^ Why dirs and not pwd? Do you really want a list of directories in the prompt? Or do you never use pushd? (in which case, dirs is better, indeed) >alias cd 'chdir \!* && setprompt' How about pushd and popd? >setprompt > >Should work for all csh-like shells. (I'm using tcsh.) If you use tcsh it makes no sense to bother with aliases. Simply use the tcsh %c feature to put the path in your prompt. It has the advantage that you can control how much of the path you put into your prompt (a full path is usually not necessary and annoyingly long). Dan -- Dan Pop CERN, CN Division Email: danpop@mail.cern.ch Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland