I have a script that starts a subscript on startup. The parent script is a 
/bin/sh script while the child script is a /bin/bash. The child script 
contains for loops which are not being executed. The child script works 
properly when logged in as root not during startup. The child script 
contains my firewall rules. To reduce complexity and increase readability 
I put repeated similar rules into a singular for loop using a array to 
contain the values. For example:

declare -a POP_SERVER
POP_SERVER[1]="pop.mail.host1"
POP_SERVER[2]="pop.mail.host2"

for SERVER in ${POP_SERVER[@]; do
  ipchains -A output -i $EXTRN_INTERFACE -p tcp \
        -s $IPADDR $UNPRIVPORTS \
        -d $SERVER 110 -j ACCEPT

  ipchains -A input -i $EXTRN_INTERFACE -p tcp ! \
        -y -s $SERVER 110 \
        -d $IPADDR $UNPRIVPORTS -j ACCEPT
done

Is there a way to use arrays with for loops during startup? Is there a 
short example someone could send me that proves it works? That way I could 
fix my start up script.

Stephen Torri
[EMAIL PROTECTED]




_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to