I'm reading a shell script for adding a progress bar to certain processes (found here). I'm having trouble understanding this (optional) line:
#BAR_EXT=${BAR_EXT-}
The comment says that this will add an extension to each file, and maybe I just need to read further, but I'm not familiar with that use of the - operator.
I know about this kind of substitution, as found in the Bash Reference Manual:
${parameter:-word}
I also know that the above will replace a null value for parameter
with word
, whereas ${parameter-word}
will not. (At least, I think I know that.)
But with nothing specified after the -
here, I'm not sure what's going on. Will this simply replace parameter
with a null value? Generally, I would accept that as a working guess and just keep reading, but with the comment mentioning adding extensions to files.
#
it's just a comment and ineffective. To understand the intention (once the hash symbol is removed) one would have to see the program. And, yes, you found the correct reference in the bash manual.