From: Kevin MacNeil <kmacneil@morgan.ucs.mun.ca>
Subject: Re: Directory Prompt
Date: 1996/05/07 [thread overview]
Message-ID: <4modf5$hjk@coranto.ucs.mun.ca> (raw)
In-Reply-To: danpop.831482768@news.cern.ch
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
next prev parent reply other threads:[~1996-05-07 4:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-25 4:00 Directory Prompt dhinkle
1996-05-04 4:00 ` Martin Hannigan
1996-05-06 4:00 ` Timothy M. Wieman
[not found] ` <4mnec0$r34@gli <4mt0vt$4cu@csugrad.cs.vt.edu>
1996-05-10 4:00 ` John C. Fowler
1996-05-10 4:00 ` John P. Speno
1996-05-11 4:00 ` John Hascall
1996-05-06 4:00 ` Thomas Leitner
1996-05-07 4:00 ` Torsten Robert Kirschner
1996-05-07 4:00 ` Dan Pop
1996-05-07 4:00 ` Kevin MacNeil [this message]
1996-05-09 4:00 ` Jeff Aitken
1996-05-14 4:00 ` David A. Lyons
1996-05-09 4:00 ` Ken Brown
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox