Download Virata CLI

Transcript
- 171 -
19Shell Tutorial
This appendix helps you understand how to use shell scrips to your
advantage, and provides a tutorial on shell programming.
19.1 Shell Tutorial - Overview
Introduction
To execute a number of CLI commands at one go, you use .cfg files
that are provided. The basic limitation of .cfg files is their sequential
routine of executing the CLI commands. Shell overcomes this
limitation by giving you the flexibility of executing the CLI commands
conditionally.
Shell is the programming tool made available to you, that helps
perform multiple tasks, with the execution of the same file. Different
input parameters to the same Shell file can be used to achieve
multiple functionality. Thus the functionality of the shell script is
decided by the inputs parameters passed to the file.
Sample.sh
In this example, the order of executing commands is decided by the
value of $1, which is the first input parameter.
if $1 eq 1
<commands to create ipoa>
goto end
fi
if $1 eq 2
<commands to create ipoa>
goto end