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: Kevin MacNeil Subject: Re: Directory Prompt Date: 1996/05/07 Message-ID: <4modf5$hjk@coranto.ucs.mun.ca>#1/1 X-Deja-AN: 153561225 references: <4lt1oa$294@random.tpgi.com.au> <4mgjpt$obj@northshore.shore.net> <1996May6.165118.16175@isac.hces.com> <4mnec0$r34@glitnir.ifi.uio.no> organization: no. reply-to: Kevin MacNeil newsgroups: comp.unix.osf.osf1 danpop@mail.cern.ch (Dan Pop) writes: ]torstenk@ifi.uio.no (Torsten Robert Kirschner) writes: ]>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) The top of the directory stack is always the current directory. You can use cut to print everything up to the first space: alias cd 'cd \!* && set prompt="`dirs|cut -f1 -d\ ` % "' A more convoluted method that grabs the first word from an array: alias cd 'cd \!* && set noglob; set dir=`dirs`; unset noglob; setprompt' alias setprompt 'set prompt="${dir[1]} % "' ]How about pushd and popd? alias pushd 'pushd \!* && cd .' alias popd 'popd \!* && cd .' ]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). Agreed. You can also use %~ if you like ~ notation. -- Kevin MacNeil \ Memorial University of Newfoundland kmacneil@morgan.ucs.mun.ca / English & Philosophy