Ref: 99980078
Title: Shell Script to Define a Config Parameter for Many Ports
Date: 12/1/86

Copyright 3Com Corporation, 1991.  All rights reserved.

A shell script is a macro-like feature.  A macro is a named file
that contains a series of individual Bridge User Interface
commands; it can be executed in any Bridge product.  A shell
script is a named file that contain C-shell language; it can only
be executed in the Bridge Network Control Server/1.  As with
macros, shell scripts can be set up to perform a specific
function on the network, and users can execute the file with a
one-line command.

In order to avoid a tedious task of defining the same port
configuration parameter for a group of ports, the following shell
script has been designed to assist the network manager.  This
shell script requires the input of the server's Ethernet address,
the first port, the last port, and the parameter being set.

#!     /bin/csh -f
#
#  NAME
#
#      setport
#
#  SYNOPSIS
#
#      setport <Ethernet address><first port><last
       port>'<parameter>'
#
set noglob

if ( $#argv != 4 ) goto usage

if ( $argv [1] == "?" ) then
    usage:
       echo "Usage: setport'<Ethernet address>' '<first port>'
                           '<last port>' '<parameter>'"
       exit
endif

switch ( $argv[2] )   /*check for the non-numeric of the first
                      port*/
     case [aA-zZ=
       echo "Illegal port number"
       exit

endsw

switch ( $argv[3] )   /*check for the non-numeric of the last
                      port*/
      case [aA-zA]
        echo "Illegal port number"
        exit

endsw

if ( $argv[2] > $argv [3] ) then
   echo "The first port must be smaller than the last port"
   exit
endif

@ i = $argv[2]

while ( $i <= "$argv[3]" )
    echo "port $i"
    echo setd \(\! $i \) "$argv[4]" | remote $argv[1]
    @ i++

The above shell script must be created under the "/user/ncs/
local" directory.  To make this shell script executable after it
has been created, enter the following command:

     chmod +x setport

To execute this shell script, enter the following command:

     setport <Ethernet address><firstport><lastport>'<parameter>'

