I've run into a problem with the SELECT CASE
structure when the variable in the CASE
statements is undefined. For instance take the following script (testcase.scr):code:
SELECT
CASE $var="one"
$num=1
CASE $var="two"
$num=2
CASE $var="three"
$num=3
CASE 1
$num=0
ENDSELECT? $num
When invoked as
kix32 testcase $var="two"
it works as expected with output of "2". But if $var is not defined the first CASE expression seems to come out TRUE as
kix32 testcase
results in output of "1".
This means that you have to be careful to explicitly check the CASE $var="" condition
as the first CASE of any SELECT CASE ENDSELECT construct.
Anyone any ideas what's going on here?
Regards
------------------
--
Gerry Mulvenna, Applications Development Manager, Computing Services
Heriot-Watt University, Edinburgh, Scotland, EH14 4AS
http://www.mulvenna.demon.co.uk/gerry/ G.J.Mulvenna@hw.ac.uk
Tel: +44-(0)131-451 3794 Fax: +44-(0)131-451 3261