#!/bin/bash
if ! lxc launch --vm "$image" "$name" <<EOF
${instance_config}
EOF
then
lxc delete -f "$name"
fi
After:
#!/bin/bash
if ! lxc launch --vm "$image" "$name" <<EOF; then
${instance_config}
EOF
lxc delete -f "$name"
fi
It breaks the script and modifies the heredoc content. It should not move the then and keep it on his own line without prepended ;.
Note: Putting the command into the if is recommended by SC2181. Obviously <<<"${instance_config}" can be used but the issue is still present when using heredoc.
shfmt v3.6.0
Before:
After:
It breaks the script and modifies the heredoc content. It should not move the
then
and keep it on his own line without prepended;
.Note: Putting the command into the if is recommended by SC2181. Obviously
<<<"${instance_config}"
can be used but the issue is still present when using heredoc.