Thread (16 messages) flat view 16 messages, 3 authors, 2016-06-15

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

From: Ping Yin <hidden>
Date: 2016-06-15 22:44:19

On Sat, Mar 1, 2008 at 3:29 PM, Junio C Hamano [off-list ref] wrote:
Ping Yin [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help