Skip to content

Commit be2d7de

Browse files
committed
Update backup scripts to use "new" test operator ([[)
1 parent f458e4c commit be2d7de

6 files changed

+15
-15
lines changed

backup/backup_etc.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ FUNCTIONS=/home/backup/scripts/backup/functions.sh
1919
SETTINGS=/home/backup/scripts/backup/settings.ini
2020
DATE="$(date +%Y%m%d)"
2121

22-
[ -e "$FUNCTIONS" ] || exit 1
22+
[[ -e "$FUNCTIONS" ]] || exit 1
2323
source "$FUNCTIONS"
2424

2525
# parse settings
26-
[ -e "$SETTINGS" ] || exit 1
26+
[[ -e "$SETTINGS" ]] || exit 1
2727
cfg_parser "$SETTINGS"
2828

2929
# read variables in [etc] section
3030
cfg.section.etc
3131

3232
# Check for the existence of the backup directory and create
3333
# it if it doesn't exist.
34-
if [ ! -d "$backup_dir" ]
34+
if [[ ! -d "$backup_dir" ]]
3535
then
3636
mkdir -p "$backup_dir"
3737
fi

backup/backup_mysql.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ FUNCTIONS=/home/backup/scripts/backup/functions.sh
1919
SETTINGS=/home/backup/scripts/backup/settings.ini
2020
DATE="$(date +%Y%m%d)"
2121

22-
[ -e "$FUNCTIONS" ] || exit 1
22+
[[ -e "$FUNCTIONS" ]] || exit 1
2323
source "$FUNCTIONS"
2424

2525
# parse settings
26-
[ -e "$SETTINGS" ] || exit 1
26+
[[ -e "$SETTINGS" ]] || exit 1
2727
cfg_parser "$SETTINGS"
2828

2929
# read variables in [mysql] section
3030
cfg.section.mysql
3131

3232
# Check for the existence of the backup directory and create
3333
# it if it doesn't exist.
34-
if [ ! -d "$backup_dir" ]
34+
if [[ ! -d "$backup_dir" ]]
3535
then
3636
mkdir -p "$backup_dir"
3737
fi

backup/backup_postgres.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ FUNCTIONS=/home/backup/scripts/backup/functions.sh
1919
SETTINGS=/home/backup/scripts/backup/settings.ini
2020
DATE="$(date +%Y%m%d)"
2121

22-
[ -e "$FUNCTIONS" ] || exit 1
22+
[[ -e "$FUNCTIONS" ]] || exit 1
2323
source "$FUNCTIONS"
2424

2525
# parse settings
26-
[ -e "$SETTINGS" ] || exit 1
26+
[[ -e "$SETTINGS" ]] || exit 1
2727
cfg_parser "$SETTINGS"
2828

2929
# read variables in [postgres] section
@@ -35,7 +35,7 @@ export PGPASSWORD="$password"
3535

3636
# Check for the existence of the backup directory and create
3737
# it if it doesn't exist.
38-
if [ ! -d "$backup_dir" ]
38+
if [[ ! -d "$backup_dir" ]]
3939
then
4040
mkdir -p "$backup_dir"
4141
fi

backup/cleanup.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
FUNCTIONS=/home/backup/scripts/backup/functions.sh
1919
SETTINGS=/home/backup/scripts/backup/settings.ini
2020

21-
[ -e "$FUNCTIONS" ] || exit 1
21+
[[ -e "$FUNCTIONS" ]] || exit 1
2222
source "$FUNCTIONS"
2323

2424
# parse settings
25-
[ -e "$SETTINGS" ] || exit 1
25+
[[ -e "$SETTINGS" ]] || exit 1
2626
cfg_parser "$SETTINGS"
2727

2828
# read which sections to clean

backup/mysql_maintenance.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
FUNCTIONS=/home/backup/scripts/backup/functions.sh
1919
SETTINGS=/home/backup/scripts/backup/settings.ini
2020

21-
[ -e "$FUNCTIONS" ] || exit 1
21+
[[ -e "$FUNCTIONS" ]] || exit 1
2222
source "$FUNCTIONS"
2323

2424
# parse settings
25-
[ -e "$SETTINGS" ] || exit 1
25+
[[ -e "$SETTINGS" ]] || exit 1
2626
cfg_parser "$SETTINGS"
2727

2828
# read variables in [mysql] section

backup/postgres_maintenance.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
FUNCTIONS=/home/backup/scripts/backup/functions.sh
1919
SETTINGS=/home/backup/scripts/backup/settings.ini
2020

21-
[ -e "$FUNCTIONS" ] || exit 1
21+
[[ -e "$FUNCTIONS" ]] || exit 1
2222
source "$FUNCTIONS"
2323

2424
# parse settings
25-
[ -e "$SETTINGS" ] || exit 1
25+
[[ -e "$SETTINGS" ]] || exit 1
2626
cfg_parser "$SETTINGS"
2727

2828
# read variables in [postgres] section

0 commit comments

Comments
 (0)