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

Re: [PATCH] Avoid unportable nested double- and backquotes in shell scripts.

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 8, 2011, 16:48 UTC
Message-ID
<20110108164825.GC28898@burratino>
In-Reply-To
<20110108162353.GB4786@gmx.de>
Ralf Wildenhues wrote:
> But git makes heavy use of "no quoting needed on RHS of assignment"
> anyway, so it seems like this would be a good move nonetheless.
No disagreement there.
> And the
> testsuite uses backticks a lot,
>From a quick grep, it seems you are right:
 $ git grep -c -F -e '`' -- 't/*.sh' | cut -d: -f2 | sum
 65126     1
 $ git grep -c -F -e '$(' -- 't/*.sh' | cut -d: -f2 | sum
 64807     1
 $ git grep -c -F -e '`' -- '*.sh' | cut -d: -f2 | sum
 13350     1
 $ git grep -c -F -e '$(' -- '*.sh' | cut -d: -f2 | sum
 07810     1
Documentation/CodingGuidelines 
 - We prefer $( ... ) for command substitution; unlike ``, it
   properly nests.  It should have been the way Bourne spelled
   it from day one, but unfortunately isn't.
> it seems a move away from that should be
> done more uniformly?

I don't see why. :) In fact, I personally would not be happy at all to see such a high-churn patch as that, while using the $( ... ) form in new code and as part of clarifications to other parts of the same lines would seem to me to be a welcome thing.

Having said all that, I have no strong investment in this. Feel free to do what works best for you.

Thanks, Jonathan

Previous: Ralf WildenhuesNext: Jonathan Nieder
Message 4 of 6 in “Avoid unportable nested double- and backquotes in shell scripts.”
  1. Avoid unportable nested double- and backquotes in shell scripts.Ralf Wildenhues, Jan 8, 2011
  2. Jonathan NiederJan 8, 2011
  3. Ralf WildenhuesJan 8, 2011
  4. Jonathan NiederJan 8, 2011
  5. Jonathan NiederJan 8, 2011
  6. Junio C HamanoJan 10, 2011

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.