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: Pierre Gaston
Subject: Re: truncating the path in the bash prompt?
Date: Wed, 14 Jan 2009 10:05:40 +0200

On Wed, Jan 14, 2009 at 9:56 AM, Dan Nicolaescu <address@hidden> 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?
>
the just released bash 4.0rc1 introduce a new variable:

        PROMPT_DIRTRIM
                If set to a number greater than zero, the value is used
                as  the  number  of  trailing directory  components  to
                retain  when  expanding the  \w  and  \W prompt  string
                escapes (see PROMPTING  below).  Characters removed are
                replaced with an ellipsis.




reply via email to

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