Remove nounset

This commit is contained in:
Dryusdan 2020-02-15 11:59:58 +01:00
parent 420a790530
commit 91247ba55c

View file

@ -6,9 +6,10 @@
## Bash strict mode ####################################
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
#set -o nounset # abort on unbound variable
## Bash color ##########################################
# Set colors
RED='\033[0;31m'
@ -45,28 +46,28 @@ then
fatal "No arguments supplied. Usage : ./mysqlbackup.sh /BASE/BACKUP/FOLDER USERNAME PASSWORD HOST PORT"
fi
if [ -v "${1}" ];
if [ -z "${1}" ];
then
fatal "Folder is not defined. Usage : ./mysqlbackup.sh /BASE/BACKUP/FOLDER USERNAME PASSWORD HOST PORT"
else
FOLDER="${1}/${DATE}"
fi
if [ -v "${2}" ];
if [ -z "${2}" ];
then
fatal "Username is not defined. Usage : ./mysqlbackup.sh /BASE/BACKUP/FOLDER USERNAME PASSWORD HOST PORT"
else
USERNAME=${2}
fi
if [ -v "${3}" ];
if [ -z "${3}" ];
then
fatal "Password is not defined. Usage : ./mysqlbackup.sh /BASE/BACKUP/FOLDER USERNAME PASSWORD HOST PORT"
else
PASSWORD=${3}
fi
if [ -v "${4}" ];
if [ -z "${4}" ];
then
warning "Host not defined, use 127.0.0.1 by default"
HOST="127.0.0.1"
@ -74,7 +75,7 @@ else
HOST=${4}
fi
if [ -v "${5}" ];
if -z "${5}" ];
then
warning "Port not defined, use 3306 by default"
PORT="3306"