Re: [PATCH v2 3/3] git-submodule: New subcommand 'summary' (3) - limit summary size
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 1, 2008, 20:26 UTC
- Message-ID
- <7vpruexkbd.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <46dff0320803010442y12c1326dk45f53ce17453b53c@mail.gmail.com>
"Ping Yin" <pkufranky@gmail.com> writes:
> On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@pobox.com> wrote: > > expr is portable?
It's not just portable but is a very old fashioned and time-proven way to do things like this.
Show 8 quoted lines
>> 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