SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".
Move the format string to the function and just parameterise the share
type.
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
setup
-out=$(shares_missing "ERROR: samba directory \"%s\" not available" 2)
+out=$(shares_missing "samba" 2)
required_result 1 "$out"
simple_test
setup
-out=$(shares_missing "ERROR: nfs directory \"%s\" not available" 2)
+out=$(shares_missing "nfs" 2)
required_result 1 "$out"
simple_test
shares_missing()
{
# Mark some shares as non-existent
- _fmt="$1"
+ _type="$1"
shift
_out=""
debug "Mark share $_n as missing share \"$_i\""
rmdir "$_i"
- _t=$(printf "$_fmt" "${_i}")
+ _t=$(printf "ERROR: %s directory \"%s\" not available" \
+ "$_type" "${_i}")
_out="${_out}${_out:+${_nl}}${_t}"
done
_n=$(($_n + 1))