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

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
Previous: Johannes SchindelinNext: Junio C Hamano
Message 7 of 18 in “Avoid using dc in git-count-objects”
  1. Avoid using dc in git-count-objectsJohannes Schindelin, Oct 25, 2005
  2. Junio C HamanoOct 26, 2005
  3. Johannes SchindelinOct 26, 2005
  4. Petr BaudisOct 26, 2005
  5. Matthias UrlichsOct 27, 2005
  6. Johannes SchindelinOct 27, 2005
  7. Linus TorvaldsOct 27, 2005
  8. Junio C HamanoOct 27, 2005
  9. Herbert XuOct 28, 2005
  10. H. Peter AnvinOct 28, 2005
  11. Herbert XuOct 28, 2005
  12. H. Peter AnvinOct 28, 2005
  13. Herbert XuOct 28, 2005
  14. H. Peter AnvinOct 28, 2005
  15. Johannes SchindelinOct 26, 2005
  16. Andreas EricssonOct 26, 2005
  17. Johannes SchindelinOct 26, 2005
  18. Andreas EricssonOct 26, 2005

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.