Use SHIFT to change the order in which %n identifier variables are interpreted in the login script. The SHIFT command allows users to enter LOGIN parameters in any order.
SHIFT has the following command format:
SHIFT [n]
Replace n with the number of places you want the variable to shift. The default is SHIFT 1.
You can shift up to 10 arguments.
When users execute 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 left.
For example, 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 LOTUS 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 IF "%2"="ACCNTS" THEN MAP G:=SYS:ACCNTS IF "%2"="LOTUS" THEN MAP S16:=SYS:APPL\LOTUS SHIFT IF "%2"<>" THEN GOTO LOOP(In the last line, ``IF ''%2`` < >'' is followed by closed quotation marks, which means ``If %2 is not blank''.)
With these commands in her login script, Mary can log in to the primary file server (named FS1) using her username, MARY, as follows:
LOGIN FS1\MARY WP ACCNTSThe parameters in Mary's LOGIN command are given the following values:
%0=FS1 %1=MARY %2=WP %3=ACCNTSMary'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 right 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 WPThe parameters in this LOGIN command are given the following values:
%0=FS1 %1=MARY %2=ACCNTS %3=WPIn 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 right so that %2 now becomes WP.
Upon executing the loop, the login script sets the word-processing environment.
For more information about using %n variables in login scripts, see ``Using LOGIN parameters with %n variables''.