local base= is equivalent to local base
They both set a local variable with null content. Try
$ eqls () { local eq=; echo ${eq:+ColPlus}; echo ${eq+Plus}; } $ eqls
Plus $ $ eqls () { local eq; echo ${eq:+ColPlus}; echo ${eq+Plus}; }
Plus $
${var:+word} resolves to nothing if the variable "var" is unset or null, and to "word" otherwise. 'echo ${eq:+ColPlus}' generates no output, so the local variable "eq" is either unset or null.
${var+word} resolves to nothing if the variable "var" is unset, else "word". 'echo ${eq+Plus}' generates "Plus", so the variable is NOT unset; therefore it is set to the null value. Same result whether the local declaration uses "=" or not.
Yes, ${var:-word} returns "word" if "var" is unset or null, else the value of "var". It looks to me as though he same result could be achieved with "$pid", but I may be missing something.
Peter
Marvin Blackburn wrote:
I am going through the /etc/init.d/functions and have some questions about some of the syntax. I'm relatively new to bash so any help would be appreciated.
I know what the local designator does; however in the assignment statement local base= user= nice= pid
I'm not sure what is happening in terms of teh = sign. What does this mean.
In addition, there is a ${pid:-}. I was expecting something after the -. What does this mean (is it returning the null value?)
-- Peter B. West <http://www.powerup.com.au/~pbwest/resume.html>
-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list