# Please read the file COPYING, README and AUTHORS for more information.
#
-NAME=`basename $0`
+NAME=$(basename "$0")
VERBOSE=0
QUIET=0
PipeDiff() {
local line
IFS=
- while read line; do
+ while read -r line; do
echo -e " | $line"
done
}
echo "Found latest generation in \"$latest_d\"."
declare -i code=-1
+ # shellcheck source=/dev/null
source "$latest_d/.stamp"
if [[ $code -ne 0 && $code -ne 24 ]]; then
# Search previous generation without errors
local previous_d=""
- for d in $(ls -1dt $target/[0-9]*-[0-9]* 2>/dev/null); do
+ # shellcheck disable=SC2045
+ for d in $(ls -1dt "$target/"[0-9]*-[0-9]* 2>/dev/null); do
[[ -d "$d" && -r "$d/.stamp" ]] || return 0
declare -i code=-1
+ # shellcheck source=/dev/null
source "$d/.stamp"
if [[ $code -eq 0 || $code -eq 24 ]]; then
}
MkTempFiles() {
- tmp_1=$(mktemp /tmp/$NAME.XXXXXX) || exit 1
- tmp_2=$(mktemp /tmp/$NAME.XXXXXX) || exit 1
- tmp_diff=$(mktemp /tmp/$NAME.XXXXXX) || exit 1
- tmp_out=$(mktemp /tmp/$NAME.XXXXXX) || exit 1
+ tmp_1=$(mktemp "/tmp/$NAME.XXXXXX") || exit 1
+ tmp_2=$(mktemp "/tmp/$NAME.XXXXXX") || exit 1
+ tmp_diff=$(mktemp "/tmp/$NAME.XXXXXX") || exit 1
+ tmp_out=$(mktemp "/tmp/$NAME.XXXXXX") || exit 1
}
CleanUp() {
for f in "${sys[@]}"; do
[[ -r "$f" && -f "$f" ]] || continue
- fname=`basename $f`
+ fname=$(basename "$f")
case "$fname" in
"backup-script.conf"|*.sh)
continue