[Top][All Lists]

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

Re: truncating the path in the bash prompt?

From: Chet Ramey
Subject: Re: truncating the path in the bash prompt?
Date: Wed, 14 Jan 2009 12:41:08 -0500
User-agent: Thunderbird (Macintosh/20081209)

Matthew Woehlke wrote:

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

You can already do something like this with parameter pattern substitution
on $PS1, though it quickly becomes unwieldy.


``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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