RHAT bug? /etc/init.d/functions:daemon()

Paul Lussier p.lussier at comcast.net
Wed Feb 1 09:51:01 EST 2006


Ben Scott <dragonhawk at gmail.com> writes:

> On 1/31/06, Michael ODonnell <michael.odonnell at comcast.net> wrote:

>>   while [ "$1" != "${1##[-+]}" ]; do
>>
>> ...and second, can anybody explain the alleged logic?
>
>   Based on the entire function, it looks like they're shooting for
> some kind of command-line option parsing.  If I read that right, the
> construct
>
> 	${1##[-+]}
>
> returns the parameter $1 with any leading plus (+) or minus (-)
> character stripped off.

And people complain about *Perl* being line noise?  If you're doing
option parsing, IMO, it's a *lot* easier to use getopt, whicn is a
bash built-in than arcane and confusing bash magic like this...

Not only would using getopt be more readable (and therefore less
confusing), but probably more maintainable in the long run as well...

-- 

Seeya,
Paul "wondering why all init scripts aren't written in perl yet..."



More information about the gnhlug-discuss mailing list