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

Re: [PATCH] contrib: added git-diffall

From
Stefano Lattarini <stefano.lattarini@gmail.com>
Date
Feb 22, 2012, 10:05 UTC
Message-ID
<4F44BE03.2000906@gmail.com>
In-Reply-To
<1329785969-828-1-git-send-email-tim.henigan@gmail.com>
On 02/21/2012 01:59 AM, Tim Henigan wrote:
> test -z $(which mktemp 2>/dev/null)
>

This is wrong: if mktemp is not avilable, the expression above will become, after command substitution and word splitting have taken pace, equivalent to:

  test -z

which, per POSIX, must return 0 (and does with at least bash 4.1.5 and dash 0.5.5.1). You should just use this instead:

  which mktemp 2>/dev/null
OK, technically you could also fix your idiom above a little and use:
  test -z "$(which mktemp 2>/dev/null)"
but seems like a useless use of indirections to me.

And all of this is naturally render moot by Junio's advice of not using which(1) in the first place ;-)

Regards,
  Stefano
Previous: Junio C Hamano
Message 8 of 8 in “contrib: added git-diffall”
  1. contrib: added git-diffallTim Henigan, Feb 21, 2012
  2. Junio C HamanoFeb 21, 2012
  3. Tim HeniganFeb 22, 2012
  4. Junio C HamanoFeb 22, 2012
  5. David AguilarFeb 22, 2012
  6. Tim HeniganFeb 22, 2012
  7. Junio C HamanoFeb 22, 2012
  8. Stefano LattariniFeb 22, 2012

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.