Use SHIFT to change the order in which %n variables are interpreted in the login script. SHIFT allows users to enter login parameters in any order. For more information on %n variables, see Login Parameters with %n Variables.
You can shift up to 10 login script variables from %0 to %9.
When users execute NetWare Login, they can include additional parameters. Each of these parameters is assigned a %n variable; in this way, the parameter's real value can be substituted for the %n variable that appears in the login script.
In the login script, you can add SHIFT with a positive or negative number to move the variables in either direction. For example, SHIFT -3 moves each %n variable three positions to the right.
SHIFT [n]
Replace n with the number of places that you want the variable to shift. The default is SHIFT 1.
When Mary logs in, she wants to access her word processing program, change the way it is set up, and map a drive to her work directory called ACCNTS.
Mary also has a command in her login script to map a drive to her DATABASE directory, but she does not need it today. The commands in Mary's login script are shown here:
:LOOP IF "%2"="WP" THEN SET WP="\U-CML\B-10\D" MAP S16:=SYS:APPL\WP\SETUP END IF "%2"="ACCNTS" THEN MAP G:=SYS:ACCNTS IF "%2"="DATABASE" THEN MAP S16:=SYS:APPL\DATABASE SHIFT IF "%2"<>">"" THEN GOTO LOOP ***THIS IS A LABEL :LOOP (free to use whatever string wanted) or LOOP: (have to use non-conflicting strings--commands)***
(In the last line,
IF "%2" < >
is followed by closed quotation marks, which means “If %2 isn't blank”.)
With these commands in her login script, and assuming a command line login, Mary can log in to the primary file server (named FS1) using her username, MARY, as follows:
LOGIN FS1\MARY WP ACCNTS
The parameters in Mary's login command are given the following values:
%0=FS1
%1=MARY
%2=WP
%3=ACCNTS
Mary's login script looks for %2, which is WP, and sets the word processing environment. Then the login script shifts the variables one to the left so that %2 now becomes ACCNTS. Upon executing the loop, the login script maps a drive to the ACCNTS directory.
Mary could also change the order of her login command without affecting the way her work environment is set up, as follows:
LOGIN MARY ACCNTS WP
The parameters in this login command are given the following values:
%0=FS1
%1=MARY
%2=ACCNTS
%3=WP
In this case, Mary's login script looks for %2, which is now ACCNTS. The login script maps a drive to the ACCNTS directory. Then the login script shifts the variables to the left so that %2 now becomes WP.
Upon executing the loop, the login script sets the word processing environment.