m2@insyte (Mike Arena) (06/22/89)
On HP-UX, it seems that the case statement doesn't function correctly.
(Or, at least, not the same way it is used in the C news scripts.)
The problem is with case statements of the form:
case "$foo" in
"") ...
*) ...
esac
If the variable foo is not set or is null then the first choice ("") should
fire but it doesn't. If you change the first line to:
case $foo in
then it works!?!?!
I changed all of the files in /bin and $NEWSBIN so that they work.
However, I would like to know if our Bourne shell is broken or if the scripts
are written incorrectly. By the way, the following produces the correct
result:
if [ "$foo" = "" ]
then
echo "It works"
fi
--
Michael J. Arena (617) 965 8450 | UUCP: ...harvard!linus!axiom!insyte!m2
Innovative Systems Techniques | ...harvard!necntc!lpi!insyte!m2
1 Gateway Center, Newton, MA 02158 | ARPA: insyte!m2@harvard.harvard.eduhenry@utzoo.uucp (Henry Spencer) (06/25/89)
In article <1989Jun21.180116.18294@insyte> m2@insyte (Mike Arena) writes: > The problem is with case statements of the form: > case "$foo" in > "") ... > *) ... > esac >If the variable foo is not set or is null then the first choice ("") should >fire but it doesn't.... >... I would like to know if our Bourne shell is broken or if the scripts >are written incorrectly... The former, I think. My recollection is that we've seen obscure shell problems before on HP boxes -- HP seems to have Done Something to the shell, perhaps as part of an incautious attempt to make it 8-bit-clean. -- NASA is to spaceflight as the | Henry Spencer at U of Toronto Zoology US government is to freedom. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
guy@auspex.auspex.com (Guy Harris) (07/19/89)
>>... I would like to know if our Bourne shell is broken or if the scripts >>are written incorrectly... > >The former, I think. My recollection is that we've seen obscure shell >problems before on HP boxes -- HP seems to have Done Something to the shell, >perhaps as part of an incautious attempt to make it 8-bit-clean. Probably correct. The SunOS 4.0 Bourne shell, which is basically the S5R3.1 Bourne shell (said shell also being 8-bit clean, BTW), handles this correctly.