User guide

set script
192 Chapter 2 Command Descriptions
Examples Configure a login script
This example defines a login script that waits for a login prompt and then
supplies a login name, and waits for a password prompt and then supplies
a password. The commands to define the login script are:
#> set script name=log1 s1=”P2[ogin:]2 S10 T4”
#> set script name=log1 s2=”P1 M{user-ejm\r} S1 [sword:]3 T4”
#> set script name=log1 s3=”M{my-p-word\r} G5”
#> set script name=log1 s4=”E{login failed} G-”
#> set script name=log1 s5=”E{login complete} G+”
Actions performed by the script:
In stanza S1:
P2 means “pause for 2 seconds before executing the rest of the
script.”
[ogin:] indicates the string to wait for.
2 is the stanza to jump to when the string is received.
S10 T4 means “wait up to 10 seconds for the string “ogin:” . If the
string does not appear in that time, jump to stanza 4.”
In stanza S2:
P1 means “pause for 1 second.”
M means “write the string that follows.”
{user-ejm\r}is the string to supply, which is a user name, followed
by a carriage return (\r).
S1 means “wait 1 second for additional input, which is a
password prompt.”
[password:] 3 is the string to wait for and the number of the
stanza to jump to when the string is received.
T4 means “jump to stanza 4 if the S1 period is exceeded.”
In stanza S3:
M{my-p-word\r} is the string to write, which is a password,
followed by a carriage return.
G5 means “jump to stanza 5.”
Stanza S4 is the “failure” path for the script.
E{login failed} is the string to write to either a terminal or a trace
buffer.
G- means “exit the script and send a failure message to the user
interface.”
Stanza S5 is the “success” path for the script.
E{login complete} is the string to write to either a terminal or a
trace buffer.
G+ means “exit the script and send a success message to the
user interface.”