Re: [PATCH] Avoid using dc in git-count-objects
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Oct 27, 2005, 15:12 UTC
- Message-ID
- <Pine.LNX.4.64.0510270801560.4664@g5.osdl.org>
- In-Reply-To
- <pan.2005.10.27.08.49.59.849081@smurf.noris.de>
On Thu, 27 Oct 2005, Matthias Urlichs wrote:
> > It'll fork a subshell, but if the $() is a builtin, it won't exec. > > That being said, "echo $((1 + 2 + $((3 + 4))))" will not even fork.
Right. Don't confuse $(..) with $((..)).
They have absolutely nothing to do with each other, except for looking a bit similar.
The $((..)) is shell-builtin arithmetic. I could imagine a broken shell forking and executing "dc" for it, but quite frankly, that sounds so unlikely as to be totally silly. So realistically, a shell either supports it or not.
Oh - there's another similarity between $(..) and $((..)). They're both POSIX 1003.2 standard features, so any "modern" shell should support them. Although in practice I don't know if that means anything else than ksh (where both syntaxes came from, actually).
Linus