[comp.sys.novell] Can't get IF..THEN..ELSE to work in login script

mcginnis@kuhub.cc.ukans.edu (01/24/91)

We have not had any luck with getting IF ... THEN ... ELSE
statements to execute without error in login scripts.  We have 
tried upper and lower case for the commands.  The IF statements 
work fine.  The else statments always return an error.  Any 
line with an else statment fails to parse


We have been trying the example on page 298, appendix A of
Novell 386 Installation manual.

Here are some examples of what we have tried:

IF DAY_OF_WEEK="Wednesday" THEN WRITE "Wed" ELSE WRITE "Else statement"

IF DAY_OF_WEEK="Wednesday" THEN WRITE "Wed"
ELSE WRITE "ELSE STATMENT"

IF DAY_OF_WEEK="Wednesday" THEN 
WRITE "Wed" ELSE WRITE "ELSE STATMENT"

plus other combinations.

What are we doing wrong?

kenh@techbook.com (Ken Haynes) (01/26/91)

In article <28114.279d8fb3@kuhub.cc.ukans.edu> mcginnis@kuhub.cc.ukans.edu writes:
>We have not had any luck with getting IF ... THEN ... ELSE
>statements to execute without error in login scripts.  We have 
>tried upper and lower case for the commands.  The IF statements 
>work fine.  The else statments always return an error.  Any 
>line with an else statment fails to parse
>
>
>We have been trying the example on page 298, appendix A of
>Novell 386 Installation manual.
>
>Here are some examples of what we have tried:
>
>IF DAY_OF_WEEK="Wednesday" THEN WRITE "Wed" ELSE WRITE "Else statement"
>
>IF DAY_OF_WEEK="Wednesday" THEN WRITE "Wed"
>ELSE WRITE "ELSE STATMENT"
>
>IF DAY_OF_WEEK="Wednesday" THEN 
>WRITE "Wed" ELSE WRITE "ELSE STATMENT"
>
>plus other combinations.
>
>What are we doing wrong?

Try using the BEGIN construct with your IF constructs.

IF <condition> THEN BEGIN
statement
statement
END

The BEGIN must appear on the same line as the IF and the THEN.

Ken

-- 
******************************************************************************
Network Support Services:

Ken Haynes, Certified Netware Engineer