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

Re: Strange behavior (possible bug) using bash command subsitution with "git branch"

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Nov 8, 2009, 22:46 UTC
Message-ID
<fabb9a1e0911081446o7793eef1kcbad964c9a73edda@mail.gmail.com>
In-Reply-To
<C71C822C.22429%kate@ning.com>
Heya
On Sun, Nov 8, 2009 at 23:11, Kate Ebneter <kate@ning.com> wrote:
> That is, if you run 'git branch' inside $() or ``, it lists the directories,
> too. I can't imagine that this is intended behavior, but perhaps I'm wrong.
Try enclosing it in quotes ;).

That is, compare: $ echo "`git branch`" with $ echo `git branch`

The kicker is that there's a * in the output of git branch, which your shell helpfully substitutes with the contents of your current directory :).

-- 
Cheers,

Sverre Rabbelier
Previous: Kate EbneterNext: Kate Ebneter
Message 2 of 6 in “Strange behavior (possible bug) using bash command subsitution with "git branch"”
  1. Kate EbneterNov 8, 2009
  2. Sverre RabbelierNov 8, 2009
  3. Kate EbneterNov 8, 2009
  4. Björn SteinbrinkNov 8, 2009
  5. Jeff KingNov 8, 2009
  6. Kate EbneterNov 8, 2009

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.