Skip to content

Commit e5f657c

Browse files
committed
Still print error messages on unset variables.
1 parent f07d3e8 commit e5f657c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bin/backup

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
set -e # Exit if a command exists with an error.
33
set -o pipefail # If any command in a pipe exits with an error, treat the whole pipe as failed.
44
set -u # Fail if a variable is used, but not defined.
5-
[ -z "${BACKUP_NAME}" ] && { echo "error: BACKUP_NAME not set"; exit 1; }
6-
[ -z "${BACKUP_GPG_KEY_ID}" ] && { echo "error: BACKUP_GPG_KEY_ID not set"; exit 1; }
7-
[ -z "${BACKUP_SSH_DESTINATION}" ] && { echo "error: BACKUP_SSH_DESTINATION not set"; exit 1; }
5+
[ -z "${BACKUP_NAME:-}" ] && { echo "error: BACKUP_NAME not set"; exit 1; }
6+
[ -z "${BACKUP_GPG_KEY_ID:-}" ] && { echo "error: BACKUP_GPG_KEY_ID not set"; exit 1; }
7+
[ -z "${BACKUP_SSH_DESTINATION:-}" ] && { echo "error: BACKUP_SSH_DESTINATION not set"; exit 1; }
88
BACKUP_INTERVAL=${BACKUP_INTERVAL:-1h}
99
BACKUP_SSH_REMOTE_DIRECTORY=${BACKUP_SSH_REMOTE_DIRECTORY:-backup}
1010

0 commit comments

Comments
 (0)