Find maximum positive integer value in Bourne Shell

Posted by l0b0 on Stack Overflow See other posts from Stack Overflow or by l0b0
Published on 2010-06-03T12:10:49Z Indexed on 2010/06/03 12:14 UTC
Read the original article Hit count: 345

Filed under:
|

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 maximum to a special value or to the maximum possible integer. The first option would require an extra check at each iteration, so I'd like to instead find out what is the maximum integer that will work with the -gt Bourne Shell operation.

© Stack Overflow or respective owner

Related posts about shell

Related posts about bourne-shell