Improved reliability of shell scripts (#699)

* Add double quotes for shell variables
* Added exit for cd command. Prevent run commands after incorrect change directory.
This commit is contained in:
rusdacent
2021-09-13 04:44:02 +03:00
committed by GitHub
parent a4dae290e2
commit 202c1d4b0e
5 changed files with 13 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ CLANG_FORMAT_BIN="/usr/bin/clang-format-12"
PROJECT_DIR=$(pwd)
cd $PROJECT_DIR
cd "$PROJECT_DIR" || exit
echo "RUN C\C++ SYNTAX CHECK"
C_FILES=$(find . \
@@ -34,7 +34,7 @@ fi
read -p "Do you want fix syntax? (y/n): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
cd $PROJECT_DIR
cd "$PROJECT_DIR" || exit
# We use root in container and clang-format rewriting files. We'll need change owner to original
local_user=$(stat -c '%u' .clang-format)