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 1Documentation/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