I\'m checking a counter in a loop to determine if it\'s larger than some maximum, if specified in an optional parameter. Since it\'s optional, I can either default the maxi
I'd stay clear of integer limits as they're non portable and problematic
$ test 123412341234112341235 -gt 1 || echo bash compares ints
-bash: test: 123412341234112341235: integer expression expected
bash compares ints
$ env test 1 -gt 123412341234112341235 || echo coreutils compares strings
coreutils compares strings
Instead I'd just do as you suggest and do the extra comparison like:
[ "$limit" ] && [ $count -gt $limit ]