Ref: 99980069
Title: Shell Scripts
Date: 8/1/86

Copyright 3Com Corporation, 1991.  All rights reserved.

A shell script is 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 contains C-shell language; it can
only be executed in the Bridge Network Control Server/1.  Similar
to 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 a large network environment, if the server's Ethernet address
is changed due to the replacement of the Ethernet Controller,
redefining all clearinghouse names associated with the old
Ethernet address can be a very time-consuming task.  With the aid
of the following shell script, replacing the Ethernet address in
the clearinghouse names can be accomplished with a one-line
command.

#! /bin/csh -f
#
#   NAME
#
#       change_enetaddr
#
#   SYNOPSIS
#
#       change _enetaddr <old address> <new address>
#
#
#

set noglob
if ( $#argv ! = 2) goto usage

if ( $#argv[1] == "?" ) then
   usage:
     echo "Usage: change _enetaddr <old address> <new address>"
     exit -1
endif

set list = `show chn `*@*@` | sed -e 1d`

if ( $#list == 0 ) then
   echo "empty clearinghouse?!"
   exit 0

endif

foreach i ( $list )
   echo -n
   show chn $i | fmt | grep $1 > /tmp/$$.1
   if ( ! -z /tmp/$$.1 ) then
     echo "unname $i">> /tmp/$$.2
     echo -n "name $i = " >> /tmp/$$.2
     set nameval = `cat /tmp/$$.1 | sed -e/$1/$2/`
     echo \"$nameval [$#nameval]\">> /tmp/$$.2
   endif
end

/bin/sh -v /tmp/$$.2
/bin/rm -f /tmp/$$.1 /tmp/$$.2

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

    chmod +x change_enetaddr

To execute this shell script, enter the following command:

    change_enetaddr <old Ethernet address><net Ethernet address>
