On Tue, 11 Feb 2003, Gordon wrote:

> Is there a way in a bash script to test if a variable contains an
> integer? I want to create a script that uses some simple arithmetic but

Nope. You'll have to do something more arcane:

    function IsInt {
        if egrep -q '[[:digit:]]+' <(echo $1)
        then
            return 0
        else
            return 1
        fi
    }

-- 
"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