git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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)" 
  }
Previous: Robin RosenbergNext: Robin Rosenberg
Message 2 of 3 in “StGit-enabled bash-prompt”
  1. Robin RosenbergOct 26, 2006
  2. Ben CliffordOct 27, 2006
  3. Robin RosenbergOct 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.