[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: truncating the path in the bash prompt?

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: Gecko/20090105 Fedora/ Thunderbird/ Mnenhy/

Dan Nicolaescu wrote:
Dan Nicolaescu <address@hidden> 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: > > address@hidden:...drivers/char/hw_random> > > when using: set prompt = "address@hidden:%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.
> > Thanks

Any 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".)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]