bug-bash
[Top][All Lists]
Advanced

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

Re: PS1 \W behaviour: how to get the "old" way back?


From: Chet Ramey
Subject: Re: PS1 \W behaviour: how to get the "old" way back?
Date: Wed, 23 Feb 2005 14:15:12 -0500

> In bash-3.0 this was added:
> 
> kk. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.
> 
> It seems that a large number of people preferred things the way they
> were before, with \W giving the basename with no tilde abbreviation.
> 
> Since there is no easy way of achieving this without resorting to
> PROMPT_COMMAND, could there be a new escape sequence added for it?

Unless I'm reading this wrong, ${PWD##*/} does the job (though it fails
if PWD == '/').  You can always use $(basename $PWD).

It's the current behavior that's tough to do using shell expansions.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.cwru.edu/~chet/




reply via email to

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