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

Michael ODonnell michael.odonnell at comcast.net
Tue Jan 31 22:24:01 EST 2006


Ben Scott wrote:
  [a surprisingly detailed response]

Many thanks to Ben, but it turns out that the puzzle was
easily solvable as soon as I abandoned my assumption that my
cow-orker has a clue about the code in quesion.  His code
(which I'd copied) was passing the args to that daemon()
function all wrong...  :-/

I was at least able to use this occasion to pick up an
interesting BASH trick.  Let's say I want to expand one of
several variables depending on circumstances.  I'd previously
have used something like a switch statement or some sort of
convoluted expression involving "eval", but next time I'll
likely do it this way:

# j=XXX k=YYY l=ZZZ
# a=j
# echo ${a}
j
# echo ${!a}
XXX
# a=k
# echo ${!a}
YYY
# a=l
# echo ${!a}
ZZZ

...in other words, that bang adds a level of indirection
that allows you to select which variable to expand.
 



More information about the gnhlug-discuss mailing list