fix exit on cd failure and unit test

This commit is contained in:
Chris Titus
2024-06-28 19:41:15 -05:00
parent 19c3b38430
commit a6484dc34b
2 changed files with 6 additions and 2 deletions

View File

@@ -15,4 +15,7 @@ jobs:
- name: Lint Bash scripts
run: |
find . -name "*.sh" -print0 | xargs -0 shellcheck
find . -name "*.sh" -print0 | xargs -0 shellcheck -f gcc | tee shellcheck.log
if grep -q "error:" shellcheck.log; then
exit 1
fi

View File

@@ -25,7 +25,8 @@ if [[ ! -d "$LINUXTOOLBOXDIR/mybash" ]]; then
fi
fi
cd "$LINUXTOOLBOXDIR/mybash"
cd "$LINUXTOOLBOXDIR/mybash" || exit
command_exists() {
command -v $1 >/dev/null 2>&1