diff options
| author | Robert Bruce Park <r@robru.ca> | 2013-11-26 13:04:30 -0800 |
|---|---|---|
| committer | Robert Bruce Park <r@robru.ca> | 2013-11-26 13:04:30 -0800 |
| commit | 2f0092ac9fab2c8d4ab205b9893d6a48f2437da2 (patch) | |
| tree | 13029a6743ecee98b74276633d9a5e7caf74b3e9 | |
| parent | 40e5ce472160762718a3e6de9390404cbd80545a (diff) | |
Use -n and -z for easier string emptiness checks.
| -rw-r--r-- | rsync_tmbackup.sh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index 4078916..08f98f8 100644 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -113,7 +113,7 @@ fi # ----------------------------------------------------------------------------- if [ -f "$INPROGRESS_FILE" ]; then - if [ "$PREVIOUS_DEST" != "" ]; then + if [ -n "$PREVIOUS_DEST" ]; then # - Last backup is moved to current backup folder so that it can be resumed. # - 2nd to last backup becomes last backup. fn_log_info "$INPROGRESS_FILE already exists - the previous backup failed or was interrupted. Backup will resume from there." @@ -134,7 +134,7 @@ while : ; do # ----------------------------------------------------------------------------- LINK_DEST_OPTION="" - if [ "$PREVIOUS_DEST" == "" ]; then + if [ -z "$PREVIOUS_DEST" ]; then fn_log_info "No previous backup - creating new one." else # If the path is relative, it needs to be relative to the destination. To keep @@ -203,7 +203,7 @@ while : ; do CMD="$CMD --itemize-changes" CMD="$CMD --verbose" CMD="$CMD --log-file '$LOG_FILE'" - if [ "$EXCLUSION_FILE" != "" ]; then + if [ -n "$EXCLUSION_FILE" ]; then # We've already checked that $EXCLUSION_FILE doesn't contain a single quote CMD="$CMD --exclude-from '$EXCLUSION_FILE'" fi @@ -249,7 +249,7 @@ while : ; do fi OLD_BACKUP_PATH=$(fn_find_backups | tail -n 1) - if [ "$OLD_BACKUP_PATH" == "" ]; then + if [ -z "$OLD_BACKUP_PATH" ]; then fn_log_error "No space left on device, and cannot get path to oldest backup to delete." exit 1 fi |
