NUMBER=`echo $LASTFIELD sed 's/^[a-zA-Z]*//g'`

TOTALNODE=`echo ${1%.*} sed 's/\(.*\)/\1.total/'`

TOTAL=`config -g $TOTALNODE sed 's/.* //'`

NEWTOTAL=$[ $TOTAL -1 ]

# Make backup copy of config file

cp /etc/config/config.xml /etc/config/config.bak

echo "backup of /etc/config/config.xml saved in /etc/config/config.bak"

if [ -z $NUMBER ] # test whether a singular node is being \ #deleted e.g. config.sdt.hosts

then

echo "deleting $1" config -d "$1"

echo Done exit 0

elif [ $NUMBER = $TOTAL ] # Test if only one item exists then

echo "only one item exists"

#Deleting node echo "Deleting $1" config -d "$1"

#Modifying item total. config -s "$TOTALNODE=0"

echo Done exit 0

elif [ $NUMBER -lt $TOTAL ] # more than one item exists then

#Modify the users list so user numbers are sequential

#by shifting the users into the gap one at a time...

echo "Deleting $1"

LASTFIELDTEXT=`echo $LASTFIELD sed 's/[0-9]//g'`

CHECKTOTAL=`config -g $ROOTNODE.$LASTFIELDTEXT$TOTAL`

if [ -z "$CHECKTOTAL" ] then

echo "WARNING: "$TOTALNODE" greater than number of items"

fi

COUNTER=1

while [ $COUNTER != $((TOTAL-NUMBER+1)) ] do

_____________________________________________________________________

724-746-5500 blackbox.com

Page 240

Page 240
Image 240
Black Box LES144BA, LES1332A, LES1408A, LES1416A, LES1348A, LES1432A Newtotal=$ $Total, While $COUNTER != $TOTAL-NUMBER+1 do