2

I saw the following (to start a nodejs express web server) and I can't find documentation about the * in this:

prompt>> DEBUG=* command

This sets DEBUG to a temporary value in the command's environment, but what value? I tried export DEBUG=* on a line of its own and DEBUG ends up being a star:

prompt>> export DEBUG=*
prompt>> printenv DEBUG
*
prompt>>

So may there isn't anything special about it, and the nodejs express web server looks to see if DEBUG is "*". Are there situations ( such as a different history of commands) where the DEBUG=* command would result in DEBUG not being a star in the command's environment?

  • I don't see what this has to do with BASH - From BASHES POV, "DEBUG" is just an environment variable and can take any value its assigned. – davidgo Apr 6 '18 at 2:59
  • My question is not about the variable name, it is about the meaning of the statement "var=*" which is certainly bash specific, because although it appeared to be assign a literal star to var, the star often has special meaning – Oliver Apr 6 '18 at 13:22
2

man bash details all the expansions that are performed during variable assignments:

The text after the = in each variable assignment undergoes tilde expansion, parameter expansion, command substitution, arithmetic expansion, and quote removal before being assigned to the variable.

None of those expansions will change the value of DEBUG=*.

If pathname expansion were performed during variable assignment, it would cause * to be replaced by a list of files. But, pathname expansion is not in the list above and, consequently, will not alter the *.

In sum, DEBUG=* sets the value of DEBUG to a literal *.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.