On Tue, 11 Feb 2003, Gordon wrote:

> It's just kind of wierd that the shell has builtin math functions, but
> can't, by itself, tell you if a value is a valid number.

Not really, since bash variables don't have type. Essentially, all
variables are strings; the fact that you can apply integer logic to some
of them doesn't change the fact that the variables themselves are strings.

That's why constructs like:

        [[ 1 < a ]]; echo $?

work. Incidentally, *any* number will evaluate to less than "a" in
lexicographic sort order, so this can be used as another valid test for
integers, and will be faster since it doesn't require spawning another
process the way egrep does.

-- 
"Of course I'm in shape! Round's a shape, isn't it?"



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to