bug-bash
[Top][All Lists]
Advanced

[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: Thu, 15 Jan 2009 16:49:59 -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

Paul Jarc wrote:
Matthew Woehlke <address@hidden> wrote:
Actually, a feature that would be REALLY helpful is a way to specify
certain directory strings that should be abbreviated.

PS1='...$(mypath)...'
mypath() {
  case $PWD/ in
    /usr/local/src/kde/svn/trunk/*)
      printf %s "${PWD/#\/usr\/local\/src\/kde\/svn\/trunk/\$src\$}";;
    /usr/local/build/kde/svn/trunk/*)
      printf %s "${PWD/#\/usr\/local\/build\/kde\/svn\/trunk/\$build\$}";;
    *) printf %s "$PWD";;
  esac
}

Yike. Okay, but if that's possible, what's the point of PROMPT_DIRTRIM? :-)

Anyway, I like this better:
PS1="...\$(mypath  \"\w\")..."

:-)

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
"Doggy!" -- Robots from Freefall (http://freefall.purrsia.com)





reply via email to

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