Fix bashism in shell scripts (#2820)

Fix bashism in shell scripts, also fixes #2816

This makes the scripts fully POSIX-compatible.
Used shellcheck to check.
This commit is contained in:
rugk 2017-07-20 00:23:59 +02:00 committed by TW
parent ffe7bdb88c
commit c5c361be0c
2 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@ set -e
set -x
NO_COVERAGE_TOXENVS=(pep8)
if ! [[ "${NO_COVERAGE_TOXENVS[*]}" =~ "${TOXENV}" ]]; then
if ! [[ "${NO_COVERAGE_TOXENVS[*]}" =~ ${TOXENV} ]]; then
source ~/.venv/bin/activate
# on osx, tests run as root, need access to .coverage
sudo chmod 666 .coverage

View File

@ -90,8 +90,8 @@ backed up and that the ``prune`` command is keeping and deleting the correct bac
export BORG_PASSCOMMAND='pass show backup'
# some helpers and error handling:
function info () { echo -e "\n"`date` $@"\n" >&2; }
trap "echo `date` Backup interrupted >&2; exit 2" SIGINT SIGTERM
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
info "Starting backup"
@ -135,7 +135,8 @@ backed up and that the ``prune`` command is keeping and deleting the correct bac
prune_exit=$?
global_exit=$(( ${backup_exit} > ${prune_exit} ? ${backup_exit} : ${prune_exit} ))
# use highest exit code as global exit code
global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
if [ ${global_exit} -eq 1 ];
then