Subject: Re: [PATCH] contrib: added git-diffall

From: Stefano Lattarini <[email-masked]>
Date: Wed, 22 Feb 2012 11:05:55 +0100

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