
hostname (config)#
Scripting mode
This section de
scribes how to perform the following actions in scripting mode:
•CreatingScripts
•ExecutingScripts
• Displaying an
d Deleting Scripts
• Installing Certificates
•EnteringPasswords
Creating scripts
There are essentially two different ways to create CLI scripts: manually or via the Script Recorder.
Manual creat
ion
This is done using the command “create script <script name>”, as shown here:
hostname(script)# create script testscript
Perform the f
ollowing actions to create the script:
• Type OR Paste the script immediately after the question mark.
• Press Return twice when you have finished.
After you ty
pe the command, you are presented with the above directions. You can then either enter
your script line by line or create it using another editor and just paste it in after the question mark. Note
that when you are manually creating scripts, you must take care to format the script file correctly. For
example, when scripting an interactive command (i.e. one that asks for input), the command often
prompts the user multiple times to enter input. You must ensure that each response to a prompt for
input is entered on a separate line in the script file.
NOTE:
The Script
Recorder takes care of all such formatting issues and hence is probably the best way to
create scripts initially.
Script recorder
The Script Recorder is started by typing in the command “record <script name>” as shown here:
hostname(script)# record testscript
Recording to script testscript.
You can then type in any “show” or “configure” mode CLI commands and they will automatically be
written to the script specified in the correct format.
To stop the Script Recorder, type “no record” as show here:
hostname(script)# no record
Recording successfully stopped.
Executing scripts
To execute a script, you must first load it using the command “load <script name>”, as shown here:
hostname(script)# load testscript
Script testscript successfully loaded.
244
Using the Command Line Interface
Commenti su questo manuale