The reason that normal startup scripts don't, is that there's no guarantee /bin/sh will point to bash, or even that bash is installed.
If you want to use bash, the first line should be /bin/bash instead of /bin/sh, so it's obvious it needs bash specifically. Jon On Sun, 28 Sep 2003, [iso-8859-1] Manoj Kumar wrote: > Is there any reason not to use bash features in init > scripts? > Consider, for example, this fragment from > /etc/sysconfig/network-scripts/ifup-post: > > DEVICETYPE=`echo $DEVICE | sed "s/[0-9]*$//"` > REALDEVICE=`echo $DEVICE | sed 's/:.*//g'` > if echo $DEVICE | grep -q ':' ; then > ISALIAS=yes > else > ISALIAS=no > fi > > In bash we can do this much faster with something like > this: > > DEVICETYPE=$DEVICE > while [[ $DEVICETYPE == *[0-9] ]]; do > DEVICETYPE=${DEVICETYPE%[0-9]} > done > REALDEVICE=${DEVICE%%:*} > if [[ $DEVICE == *:* ]]; then > ISALIAS=yes > else > ISALIAS=no > fi > > Okay, the loop that replaces the first line is messy, > but it saves > a couple of forks and an exec. The other two changes > are both > simpler and faster. > > So why do most init scripts use sed and grep to > process > strings? It can't be a desire to allow them to work > with the > Bourne shell (why would we want that anyway?) because > some > scripts do use bash features. > > [EMAIL PROTECTED] > > > ________________________________________________________________________ > Yahoo! India Matrimony: Find your partner online. > Go to http://yahoo.shaadi.com > > > _______________________________________________ > Redhat-devel-list mailing list > [EMAIL PROTECTED] > https://www.redhat.com/mailman/listinfo/redhat-devel-list > _______________________________________________ Redhat-devel-list mailing list [EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-devel-list