[rear-devel] Having $BACKUP_TYPE in quotes avoids "unary operator expected" error

Johannes Meixner jsmeix at suse.de
Fri Jun 6 15:18:25 CEST 2014


Hello,

a minor fix for
   usr/share/rear/verify/NETFS/default/07_set_backup_archive.sh
   usr/share/rear/verify/NETFS/default/55_check_backup_archive.sh
   usr/share/rear/restore/NETFS/default/40_restore_backup.sh

Therein
   if [ $BACKUP_TYPE == "incremental" ]; then
should be changed to
   if [ "$BACKUP_TYPE" == "incremental" ]; then

This avoids error messages like "[: ==: unary operator expected"
when $BACKUP_TYPE is unset or the empty string - e.g.:
-----------------------------------------------------------------------
$ if [ $BACKUP_TYPE == "incremental" ]; then echo foo ; fi
bash: [: ==: unary operator expected

$ if [ "$BACKUP_TYPE" == "incremental" ]; then echo foo ; fi
$
-----------------------------------------------------------------------

Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany
HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer



More information about the rear-devel mailing list