TotalNET Advanced Server 5.2 Reference Manual

if...then

This command executes one or more commands under specified conditions. You may nest if...then statements within other if...then statements up to nine levels deep.

Usage

if condition [and|or [condition]] then 
	command
	[command]
[else]
	[command]
	[command]
[end]

Options

condition 

Specify a conditional clause or equation involving any of the identifier variables listed in "Identifier Variables""Identifier Variables. Enclose condition equation values in quotation marks. You may use the following operators in conditional equations:

= "equals" 

<> "does not equal" 

> "is greater than" 

>= "is greater than or equal to" 

< "is less than" 

<= "is less than or equal to" 

and 

Specify all of the surrounding conditional clauses. Use commas to separate conditions in three-part conditional clauses 

or 

Specify one of the surrounding conditional clauses. Use commas to separate conditions in three-part conditional clauses 

command 

Specify a login script command that you want to execute if circumstances meet the specified condition. Place consecutive commands in the then portion on separate lines. 

else 

Restrict the instances of the if...then statement. If you only specify one command after else, the end statement becomes optional. This option must occupy its own line. 

end 

Conclude the if...then sequence. If you specify only one command after the else or if the if...then statement only consists of one logical line, the end statement becomes optional. The end statement must occupy its own line. In a nested if...then statement, end applies only to the current level. Use end for every level that requires it. 

Note

The DOS environment variable does not work properly as a condition for an if statement for the TAS login.exe program.

Example

Use the following sequence to map q:=nwsolaris/sys:/public/q&a to members of the support group, terminate the login script on Saturdays and Sundays, send the message "You spend 1/7 of your life on Monday. Have a nice day. :-)" on Mondays, send the message "Department meeting at 10:00." to members of the support group on Fridays with an alert of three sounds, and send the message "Happy birthday, Levi!" on October 29:

if member of support then map q:=nwsolaris/sys:/public/q&a
if day_of_week = saturday or day_of_week = sunday then exit
if day_of_week = monday then write You spend 1/7 of your life on Monday.\nHave a nice day. :-)
end
if day_of_week = friday then
if member of support then
write Department meeting at 10:00."
fire phasers 3 times
pause
end
end
if month = "10", day = "29", and login_name = "levi" then write "Happy birthday, Levi!"