Charles Steinkuehler wrote: <snip> > > #FTP Server > > #INTERN_SERVER2="-a -P tcp -L $EXTERN_IP 21 -R 192.168.1.2 21" > > #INTERN_SERVER3="-a -P tcp -L $EXTERN_IP 21000 -R 192.168.1.2 21000" > > The scripts stop at the first missing number, and they start counting from > zero, so without INTERN_SERVER0 and INTERN_SERVER1 defined, the rest of your > server settings will be ignored. > > This is kind of a pain, and an artifact of the broken sort command on > earlier systems... > > If anyone wants a project, you could work on adapting the walklist function > to support missing numbers and send me the code...
Right now I don't see who to avoid the problem unless you impose some sort of maximum variable count. The walk_list condition is designed to stop via while eval ITEM="\$$BASENAME$x" [ "$ITEM" != "" ] do I grepped walk_list in /etc and found 10 instances in both ipfilter.conf and network.conf. Suppose you set a max list variable size to 20. I might loose a few pico seconds off my life but how long will that take lrp to boot for each call to walk_list configured with a max list variable this big? Wouldn't 20 more than cover all the lists that LRP uses? I ripped this idea off from esb2 and modified it for a project I am working on. I wacked out a section of code and then modified the script to make widgets not Oracle instance directories. cat ./walk #!/bin/bash # Ident: walk # Define the number of widgets you are going to # create. This should equal then number of widgetsX # variables you have uncommented. This is for all you # performance freaks. The loop examines which variable # exists before using it. max_widgets=8 # Define the widgets variables. See max_widgets. # my_widget0=VULTURES my_widget1=BALOO my_widget2=MOWGLI # my_widget3=KAA # my_widget4=HATHI # my_widget5=BAGHEERA my_widget6=KING my_widget7=LOUIE # ad nausium # Now make the widgets # Starting widget variable number. widgets_list=0 while [ ${widgets_list} -lt ${max_widgets} ] do # See if the $my_widgetX varable exists eval current_widget="\$my_widget${widgets_list}" if [ "${current_widget}" != "" ] then # Now make the widget. echo "widget produced = ${current_widget}" fi # Next widget please. widgets_list=$((${widgets_list} + 1 )) done # Done creating widgets. Here's the output ./walk widget produced = BALOO widget produced = MOWGLI widget produced = KING widget produced = LOUIE Here's the walk_list function cat walk_list ############################################################################### #General utilities to process lists of environment variables ############################################################################### # A function to walk a list of environment variables # To use, define a series of BASENAMEx lines in network.conf # where x is an integer number # $1 = List Basename # $2 = Initial integer suffix (usually 0 or 1) # $3 = Procedure to call # $4+= Parameters to pass to procedure # NOTE: Called procedure can reference local walk_list variables, like x or y walk_list () { # x = Variable index, y = count of processed variables local BASENAME=$1 x=$2 PROCEDURE=$3 ITEM="" y="0" shift 3 while eval ITEM="\$$BASENAME$x" [ "$ITEM" != "" ] do y=$(($y + 1)) # 'Call' the procedure, passing the variable to process and any args eval $PROCEDURE $BASENAME$x $* x=$(($x + 1)) done WALK_COUNT=$y } Greg _______________________________________________ Leaf-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/leaf-user