All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Bailey <charles@hashpling.org>
To: Alex Jones <ajones@netsertive.com>
Cc: git@vger.kernel.org
Subject: Re: git branch in Bash subshell "$(git branch -a)" including ls output as part of return?
Date: Mon, 7 Dec 2015 17:02:59 +0000	[thread overview]
Message-ID: <20151207170259.GA25915@hashpling.org> (raw)
In-Reply-To: <20151207165810.GA25856@hashpling.org>

On Mon, Dec 07, 2015 at 04:58:10PM +0000, Charles Bailey wrote:
> 
> Looking at the two outputs, you are seeing the shell's glob expansion of
> the '*' current branch marker. You probably want to quote the command
> expansion to prevent this:
> 
> echo "$(git branch -a)"

Pressing send has, of course, caused me to think further. You probably
don't want to parse the output of a "porcelain" command such as "git
branch" at all, but instead look at using something like "git
for-each-ref", perhaps with the --format=%(refname) option, grepping out
master and iterating through the rest.

  reply	other threads:[~2015-12-07 17:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 16:52 git branch in Bash subshell "$(git branch -a)" including ls output as part of return? Alex Jones
2015-12-07 16:58 ` Charles Bailey
2015-12-07 17:02   ` Charles Bailey [this message]
2015-12-07 17:57     ` Alex Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151207170259.GA25915@hashpling.org \
    --to=charles@hashpling.org \
    --cc=ajones@netsertive.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.