On converting some bash scripts to a platform where only /bin/sh is available i'm stumble about this bash construct:
#!/bin/sh
RSTPD=/sbin/rstpd
RSTPCTL=/sbin/rstpctl
RSTP=0
bridgeprefix="gbr"
#UPDATE_STRING=-b eth2 eth3
BRIDGES="0"
CSIF[0]="eth2"
SSIF[0]="eth3"
for b in $BRIDGES ; do
echo Starting service bridge $bridgeprefix$b
brctl addbr $bridgeprefix$b || RETVAL=1
if [ $RSTP == 0 ] ; then
brctl stp $bridgeprefix$b on
brctl setbridgeprio $bridgeprefix$b 65000
fi
for br in ${CSIF[$b]} ; do #<--bad substitution
echo Adding CSIF $br on $bridgeprefix$b
ifup $br
brctl addif $bridgeprefix$b $br || RETVAL=1
done
done
I got a syntax error: bad substitution on the second for loop.
Howto adapt this bash construct to a sh compatible construct?
#!/bin/sh
What is BRIDGES, $RSTP etc? This is not the whole script. Also addset -x
just beneath#!/bin/sh
– Valentin Bajrami Oct 21 '14 at 11:41