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

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



hi,

On Wed, Aug 24, 2005 at 04:50:40PM +0200, Marc Chantreux wrote:
> for example, in /etc/init.d/mysqld
> 
> mysqld_get_param() {
>         /usr/sbin/mysqld --print-defaults \
>                 | tr " " "\n" \
>                 | grep -- "--$1" \
>                 | tail -n 1 \
>                 | cut -d= -f2
> }
> 
> can be written like :
> 
> mysqld_get_param () {
>     local string=$( /usr/sbin/mysqld --print-defaults | grep -o -- "--$1=[^ ]*" )
>     echo ${string#*=}
> }

as a general rule, stuff like this can be reported as wishlist bugs
to the package in question (with patch attached).  i think in many cases
if what you are doing is replacing a set of hackish/semi-broken commands
with something simpler and more elegant, you'll have a good chance of
having the patch accepted.

in this case, however, you are reducing a set of simple and non-intensive
system commands from 5 to 3 (and possibly introducing some non-posixish
stuff according to Miquel).  i can't guarantee you christian or i would
bother to include it.  reduce it to one fairly understandable command and
maybe :)


	sean

Attachment: signature.asc
Description: Digital signature


Reply to: