RHAT bug? /etc/init.d/functions:daemon()
Steven W. Orr
steveo at syslang.net
Wed Feb 1 10:07:06 EST 2006
On Wednesday, Feb 1st 2006 at 09:50 -0500, quoth Paul Lussier:
=>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...
Good point. I'd just like to add that using getopt also means that you are
providing POSIX compliance. Things like
ab:cd:
as the first arg to getopt and then parsing a command line like
foo -dacb darg barg realarg1
is just not a trivial thing to support. Calling getopt not only makes it
easy but also makes some of the fine points of the standard easy to
support.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the gnhlug-discuss
mailing list