Re: StGit-enabled bash-prompt
- From
Ben Clifford <benc@hawaga.org.uk>
- Date
- Oct 27, 2006, 10:01 UTC
- Message-ID
- <Pine.LNX.4.64.0610270957020.9123@dildano.hawaga.org.uk>
- In-Reply-To
- <200610262317.30209.robin.rosenberg.lists@dewire.com>
On Thu, 26 Oct 2006, Robin Rosenberg wrote:
> Of course you will read and understand this code. I don't know how good an > idea it is to use the DEBUG trap this way.
I set my prompt without using it, with something approximating this being defined in my .bash_profile. I think the use of ' instead of " causes evaluation of __prompt_githead be delayed until the prompt is displayed.
PS1='$(__prompt_githead) '$PS1
__prompt_githead() {
PS_GIT=$(git-symbolic-ref HEAD 2>/dev/null) || exit
echo -n " $(basename $PS_GIT)"
}