Re: [PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Ping Yin" <pkufranky@xxxxxxxxx> writes:

> On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> expr is portable?

It's not just portable but is a very old fashioned and time-proven way to
do things like this.

>>         if summary_limit=$(( $2 + 0 )) 2>/dev/null ||
>>            test "$2" != "$summary_limit"
>>         then
>>                 usage
>>         fi
>>
>
> summary_limit=$(( $2 + 0 )) will always has return status 0

Ah, there's a typo there.  The intention was to reject non numbers

	for two in 43 -32 'deadbeef' ' -27' HEAD ''
        do
		if sl=$(( $two + 0 )) 2>/dev/null && test "$two" == "$sl"
                then
                	echo Ah, "$two", that is a number.
		else
                	echo You gave me an un-number "'$two' (vs '$sl')".
		fi
	done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux