SC2059: Don't use variables in the printf format string.
Use printf "..%s.." "$foo".
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
if $first ; then
onnode "$n" [ -r "$f" ] || {
+ # This function takes a format string
+ # shellcheck disable=SC2059
msg=$(printf "$fmt" "$f" "$n")
error "$msg"
continue 2;
if [ "$_ip" = "$_master_ip" ] ; then
_options="MASTER${_options:+,}${_options}"
fi
- printf "${_ip}${_options:+\t}${_options}\n"
+ # There is no other way to do this and keep shellcheck happy.
+ # The tab character must be in the format string and the
+ # format string must contain no variables. Some shells will
+ # expand a tab if it is in an argument but others won't.
+ if [ -n "$_options" ] ; then
+ printf "%s\t%s\n" "$_ip" "$_options"
+ else
+ echo "$_ip"
+ fi
done <<EOF
$natgw_nodes
EOF