|
From: | Matthew Woehlke |
Subject: | Re: truncating the path in the bash prompt? |
Date: | Wed, 14 Jan 2009 11:18:10 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.19) Gecko/20090105 Fedora/2.0.0.19-1.fc10 Thunderbird/2.0.0.19 Mnenhy/0.7.5.0 |
Dan Nicolaescu wrote:
Dan Nicolaescu <dann@ics.uci.edu> writes: > In tcsh %c can be used to only show the last few directory names in a> path (also see the ellipsis variable). > > For example for this directory: > > /lib/modules/2.6.21-1.3194.fc7/kernel/drivers/char/hw_random/ > > the prompt can look like this: > > user@machine:...drivers/char/hw_random> > > when using: set prompt = "%n@%m:%c03%# " > > Given the tendency of directory hierarchies to get deeper, it is very> useful to be able to see some more context, so it would be great if > bash also supported something similar. > Sure, this can be implemented by using shell commands to set the > prompt, but it would be much nicer if it was built in.> > ThanksAny comments on this old posting?
This is why my prompts are tending to migrate to having a \n between the directory and the end of the prompt :-).
Actually, a feature that would be REALLY helpful is a way to specify certain directory strings that should be abbreviated. For example, I build KDE from sources, with source in /usr/local/src/kde/svn/trunk and build objects in /var/local/build/kde/svn/trunk. It would be great if bash could abbreviate these as, say, "$src$' and '$build$', respectively. (That is, I would somehow tell bash that I want the leading directory component "/foo/whatever/" abbreviated as "bar", where both of those are arbitrary strings. As another example, abbreviate "/net/remote2/corp/home3/" as "~" :-). Yes the slash should be stripped; the idea being that "/net/remote2/corp/home3/dan" would become "~dan".)
-- Matthew Please do not quote my e-mail address unobfuscated in message bodies. -- "Ah, yes. Control the media and you control the world." -- from a story by Raven Blackmane
[Prev in Thread] | Current Thread | [Next in Thread] |