check for numeric content in a shell script (FreeBSD sh)

Parv parv at pair.com
Thu Jun 24 18:36:27 UTC 2010


in message <20100624183407.GA49923 at holstein.holy.cow>,
wrote parv at pair.com thusly...
>
> #  Matches a number, either positive (without '+' sign) or
> #  negative, which is either a whole number; or a real number
> #  ending with decimal point, or a real number with or without
> #  leading digits before the decimal point.
.                 ^
.                 ^  plural
> ^
> -?
> (
>   [0-9]  [.]? [0-9]*
>     |
>   [0-9]? [.]  [0-9]+
.        ^
.        ^  oops

Please change the immediately above regex portion to ...

  [0-9]* [.]  [0-9]+


  - parv

> )
> $

-- 



More information about the freebsd-questions mailing list