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

Re: t0005-signals.sh fails with ksh

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2015, 20:34 UTC
Message-ID
<xmqq1tiqkdue.fsf@gitster.dls.corp.google.com>
In-Reply-To
<31108626.20150508231514@gmail.com>
evgeny <illumsoft.org@gmail.com> writes:
Show 6 quoted lines
> expecting success: 
>         OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
>         test "$OUT" -eq 141
>
> t0005-signals.sh[499]: eval: syntax error at line 4: `(' unmatched
> Memory fault
Does this work if you did
	OUT=$( ( (large_git ; echo $? 1>&3) | : ) 3>&2 ) &&
instead?
Show 6 quoted lines
> 'man ksh' reads:
>   (list)
>     Execute  list  in  a  separate environment.
>     Note, that if two adjacent open parentheses are needed for nesting,
>     a space must be inserted to avoid evaluation as an arithmetic command as
>     described above.

Hmm, I cannot see "as described above" in your message, but isn't that talking about a common mistake of turning cmd1 in this pipeline

	x=$(cmd1 | cmd2)
into a series of two commands, e.g. (cmd1a && cmd1b) and saying
	x=$((cmd1a && cmd1b) | cmd2)

which does make "$((" interpreted as the beginning of arithmetic expansion?

And the "OUT=$( ((large..." construct seems to be written in order to avoid that exact issue (notice the SP after "$(").

Puzzled....
Previous: evgenyNext: Jeff King
Message 2 of 11 in “t0005-signals.sh fails with ksh”
  1. evgenyMay 8, 2015
  2. Junio C HamanoMay 8, 2015
  3. Jeff KingMay 8, 2015
  4. Jeff KingMay 8, 2015
  5. Junio C HamanoMay 8, 2015
  6. evgenyMay 8, 2015
  7. Andreas SchwabMay 9, 2015
  8. Junio C HamanoMay 8, 2015
  9. Jeff KingMay 8, 2015
  10. brian m. carlsonMay 9, 2015
  11. evgenyMay 8, 2015

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.