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]

 



On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Ping Yin <pkufranky@xxxxxxxxx> writes:

>
>  > +             -n|--summary-limit)
>  > +                     if test -z "$2" || echo "$2" | grep --quiet -v '^-\?[0-9]\+$'
>
>  \?\+?????
>
>         summary_limit=$(expr "$2" : '[0-9][0-9]*$')
>
expr is portable?

>  or even
>
>         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
So i use
            summary_limit=$(($2 + 0))
            if test $summary_limit = 0 -a "$2" != 0
            then
                usage
            fi




-- 
Ping Yin
--
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