On 01/04/2011 01:54 AM, Jim Meyering wrote: > Bruce Korb wrote: >> On 01/03/11 16:13, Eric Blake wrote: >>> $ /bin/sh -c 'v=`nonesuch` 2>/dev/null' >>> nonesuch: not found >>> $ /bin/sh -c 'v=`(nonesuch) 2>/dev/null`' >>> $ >> >> Just for grins, how about trying: >> >> /bin/sh -c 'v=`exec 2>/dev/null;nonesuch`' >> >> I think it works for me on a Sun box:
It also works on FreeBSD. > Good idea. Avoiding an unnecessary sub-shell is always welcome. > I'll wait for your "ok". Looks good to me. We've already got one sub-shell (the ``), so avoiding the second (the ()) is indeed nicer, and here the exec trick works precisely because it only affects the `` subshell. > @@ -143,7 +143,7 @@ v=`echo "$v" |sed 's/^v//'` > # Don't declare a version "dirty" merely because a time stamp has changed. > git update-index --refresh > /dev/null 2>&1 > > -dirty=`(git diff-index --name-only HEAD) 2>/dev/null` || dirty= > +dirty=`exec 2>/dev/null; git diff-index --name-only HEAD` || dirty= -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature