[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: better init.d/* : who carres ?

First of all, thank you all for your answers.

i'll provide some documented, posix compliant, one piped patches as wishlist.

Of course this would all be so much simpler if we could actually use the
power of modern shells (post 1993) in init scripts - subprocesses
wouldn't be required at all....

that is a point which surprise me : i understand the dash for a posix and lightweight attitude but why use bash as "modern shell" ? why not perl or zsh (which are both more powerfull) ?

in zsh, for example, pipes are not required anymore for the mysqld_get_param function :

# defaults are stored in an array
# global to the script because the result isn't volatile

local mysqld_defaults=( $(/usr/sbin/mysqld --print-defaults) )

mysqld_get_param () {

 # ${mysqld_defaults%--$1*}
 # returns all elements of mysqld_default that does not match
 # --$1*
 # (M) invert the result
 # for all those elements, #*= delete the '=' caracter and
 # every symbols before it.

 echo ${${(M)mysqld_defaults%--$1*}#*=}


Reply to: