Run shellcheck on all shellscripts

This commit is contained in:
Erik Westrup
2022-02-01 17:15:47 +01:00
parent 79d13a1e64
commit 9b7db6d999
4 changed files with 30 additions and 30 deletions
+5 -5
View File
@@ -7,11 +7,11 @@ set -euo pipefail
# Assert that all needed environment variables are set.
assert_envvars() {
local varnames=($@)
local varnames=("$@")
for varname in "${varnames[@]}"; do
# Check if variable is set, then if it is not empty (need to do both as of `set -u`).
if [ -z ${!varname+x} ] || [ -z ${!varname} ] ; then
printf "%s must be set with a value for this script to work.\n\nDid you forget to source a /etc/restic/*.env profile in the current shell before executing this script?\n" $varname >&2
if [ -z ${!varname+x} ] || [ -z "${!varname}" ] ; then
printf "%s must be set with a value for this script to work.\n\nDid you forget to source a /etc/restic/*.env profile in the current shell before executing this script?\n" "$varname" >&2
exit 1
fi
done
@@ -37,6 +37,6 @@ trap exit_hook INT TERM
# Check repository for errors.
restic check \
--option b2.connections=$B2_CONNECTIONS \
--verbose=$RESTIC_VERBOSITY_LEVEL &
--option b2.connections="$B2_CONNECTIONS" \
--verbose="$RESTIC_VERBOSITY_LEVEL" &
wait $!