Fix quoting and escaping shellcheck errors #38
Loading…
Reference in New Issue
No description provided.
Delete Branch "shellcheck-escapes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
shellcheck was still complaining about a few SC1117 and SC2086
warnings. I ignored those that did not seem necessary and fixed the
rest. The less linter noise the better.
I need validation that I understood these checks correctly, I'll be testing them in a few minutes.
I'm not sure printf likes to see escapes line breaks. Did you test this? Did it work?
I've added some inline comments
@ -84,3 +84,3 @@
# SSH connection failed
new_error=$(printf "Failed to connect to \`%s' within %s seconds" "${item}" "${SSH_CONNECT_TIMEOUT}")
SERVERS_SSH_ERRORS=$(printf "%s\n%s" "${SERVERS_SSH_ERRORS}" "${new_error}" | sed -e '/^$/d')
SERVERS_SSH_ERRORS=$(printf "%s\\n%s" "${SERVERS_SSH_ERRORS}" "${new_error}" | sed -e '/^$/d')
I'm not sure printf likes to see escaped line breaks. Did you test this? Did it work?
I've just tested manually and it worked, we will see tomorrow if it worked when run from cron.
@ -123,6 +123,8 @@ pick_server() {
if [ -e "${PIDFILE}" ]; then
pid=$(cat "${PIDFILE}")
# Does process still exist ?
# ignore check because multiple processes might exist
AFAIK only a single PID can be in this pidfile, so we can surrounf the variable with double-quotes and not ignore the warning
Fixed
@ -367,2 +369,4 @@
RSH_COMMAND="ssh -p ${SSH_PORT} -o 'ConnectTimeout ${SSH_CONNECT_TIMEOUT}'"
# ignore check because we want it to split the different arguments to $rep
# shellcheck disable=SC2086
This one is OK
If everything is okay tomorrow, I will merge.
Everything works just fine with the escaped characters and the quoted variable.