Click to See Complete Forum and Search --> : If test problem


D@7@K|N&
12-30-2002, 11:03 PM
Hey guys....

I'm having a problem with a script that I wrote. The problem that I'm having is with the 'if' test. Here's the code...

echo "Enter data."
read variable
if [-z $variable]
then
echo "Please restart script and enter variable when asked."
exit
else
...else stuff...
fi

I get an error that looks like this:
./fw-calc: [-z: not found

I've tried several different ways and all come out with basically the same result. I want the logic to read as follows...

if variable is null
then
...variable null code...
else
...variable NOT null code...
fi

Any help would be appreciated. Thanks.

D@7@K|N&
12-30-2002, 11:05 PM
Oh, this is in Solaris 8 BTW if that helps.