See Shell Parameter Expansion, {parameter:-word}
.
${parameter:-word}
If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
So ${1:-}
is the first argument of the function log_daemon_msg
or the empty string if the function was called without arguments or with an empty first argument.
Normally, that doesn't really make sense, as just writing $1
would have the same effect. However, if your script runs with set -u
(exit when using an undefined variable) ${1:-}
can be used to get the standard-behavior ($1
turns into the empty string if unset). But the echo -n "$1: $2"
at the end would still fail in the case of missing arguments.