[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
if statement bug.
From: |
Charles Eakins |
Subject: |
if statement bug. |
Date: |
Wed, 11 Jul 2001 18:41:56 -0700 |
In development here at my company, have several shell scripts we use, they
all work fine under a Bourne shell, but with bash I've found a problem
parsing an if statement for example:
Let's say we go and execute one of our programs temp_variable=`ourprogram`
it will either return a integer value, or nothing, or 0.
This works under bourne shell on a mix of different unices.
if [ "$temp_variable" = "" -o "$temp_variable" -eq 0 ]
then
do_something_creative
fi
However under Bash you get:
test.sh: [: : integer expression expected
I would think since the first part of that statement is already true, that
it would just ignore the rest, since now the if statement is true, correct
me if I'm wrong, granted we did get around it, however hoping to let you
guys know, so there can be some consistency across multiple platforms.
Thanks
Charles Eakins
AppWorx Corporation
Senior Quality Assurance Engineer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- if statement bug.,
Charles Eakins <=