From e608b7d3443683754e816c8312a9f8c516a9f9f3 Mon Sep 17 00:00:00 2001 From: VeryTastyTomato <8625408+VeryTastyTomato@users.noreply.github.com> Date: Mon, 30 Nov 2020 07:56:58 +0100 Subject: [PATCH] fix: shellcheck warnings (#663) SC2086: Double quote to prevent globbing and word splitting. SC2162: read without -r will mangle backslashes --- benchmark.sh | 2 +- ci/build.bash | 11 +++++------ ci/set_rust_version.bash | 4 ++-- ci/test.bash | 8 ++++---- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/benchmark.sh b/benchmark.sh index 57c3879..35ec6cf 100755 --- a/benchmark.sh +++ b/benchmark.sh @@ -22,7 +22,7 @@ echo "The use of this tool requires $REQUIRED to be installed and available in y echo 'Please enter the path you would like to benchmark:' if [ -z ${FILE+x} ]; then - read input + read -r input else input=$FILE fi diff --git a/ci/build.bash b/ci/build.bash index 7fad007..89734ac 100755 --- a/ci/build.bash +++ b/ci/build.bash @@ -11,13 +11,12 @@ TARGET_TRIPLE=$2 # $3 {boolean} = Whether or not building for release or not. RELEASE_BUILD=$3 -required_arg $CROSS 'CROSS' -required_arg $TARGET_TRIPLE '' +required_arg "$CROSS" 'CROSS' +required_arg "$TARGET_TRIPLE" '' if [ -z "$RELEASE_BUILD" ]; then - $CROSS build --target $TARGET_TRIPLE - $CROSS build --target $TARGET_TRIPLE --all-features + $CROSS build --target "$TARGET_TRIPLE" + $CROSS build --target "$TARGET_TRIPLE" --all-features else - $CROSS build --target $TARGET_TRIPLE --all-features --release + $CROSS build --target "$TARGET_TRIPLE" --all-features --release fi - diff --git a/ci/set_rust_version.bash b/ci/set_rust_version.bash index d822cd5..26a8106 100755 --- a/ci/set_rust_version.bash +++ b/ci/set_rust_version.bash @@ -1,4 +1,4 @@ #!/usr/bin/env bash set -e -rustup default $1 -rustup target add $2 +rustup default "$1" +rustup target add "$2" diff --git a/ci/test.bash b/ci/test.bash index 611e011..3f974ea 100755 --- a/ci/test.bash +++ b/ci/test.bash @@ -9,8 +9,8 @@ CROSS=$1 # $1 {string} = TARGET_TRIPLE=$2 -required_arg $CROSS 'CROSS' -required_arg $TARGET_TRIPLE '' +required_arg "$CROSS" 'CROSS' +required_arg "$TARGET_TRIPLE" '' -$CROSS test --target $TARGET_TRIPLE -$CROSS build --target $TARGET_TRIPLE --all-features +$CROSS test --target "$TARGET_TRIPLE" +$CROSS build --target "$TARGET_TRIPLE" --all-features