Customizing the user environment

Using LOGIN parameters with %n variables

Some variables in a login script can be indicated by a percent sign (%) followed by a number from 0 to 9.

When a user logs in, he or she can type additional parameters that the LOGIN utility passes to the login script. The login script then substitutes these parameters for any %n variables in the login script. These variables are replaced in order by the parameters the user typed when executing the LOGIN utility.

The %0 variable is replaced by the name of the NetWare server the user typed at the command line, and %1 is replaced by the user's login name. The remaining variables change, depending on what the user types when executing LOGIN. The %n variables must precede all command line options.

The SHIFT login script command allows you to change the order in which these %n variables are substituted. For more information about the SHIFT command, see ``SHIFT''.

The %n variables can be used in WRITE statements if they are included within the quotation marks:

   WRITE "My login name is %1."
For example, suppose a login script contains the following commands:
   IF "%2"="SALES" THEN
   WRITE "Meeting today"
   END
   IF "%3"="LEGAL" THEN
   WRITE "Report is due tomorrow"
   END
If user RON logged in by typing the following command:
   LOGIN COUNT\RON SALES MARKETING
then the login script would substitute the values Ron entered at the keyboard for the %n variables in the login script, as shown here:
   %0=COUNT
   %1=RON
   %2=SALES
   %3=MARKETING
Since %2 is replaced by ``SALES'', the message ``Meeting today'' is displayed on Ron's screen. However, since %3 is replaced by ``Marketing'', Ron does not see ``Report is due tomorrow''.
© 1999 The Santa Cruz Operation, Inc. All rights reserved.
UnixWare 7 Release 7.1.1 - 5 November 1999