From 9c78a79c02d38a98a38d852e10b16d8cb7a59c91 Mon Sep 17 00:00:00 2001 From: Androbin Date: Wed, 29 Nov 2017 01:31:47 -0800 Subject: Various Shell Script Fixes and Improvements - Part One see #4023 Closes #4051. PiperOrigin-RevId: 177279457 --- src/test/shell/bazel/workspace_test.sh | 2 +- src/test/shell/integration/java_integration_test.sh | 2 +- src/test/shell/integration/loading_phase_tests.sh | 2 +- src/test/shell/integration/progress_reporting_test.sh | 2 +- src/test/shell/integration_test_setup.sh | 2 +- src/test/shell/testenv.sh | 2 +- src/tools/xcode/actoolwrapper/actoolwrapper.sh | 2 +- src/tools/xcode/environment/environment_plist.sh | 2 +- src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/test/shell/bazel/workspace_test.sh b/src/test/shell/bazel/workspace_test.sh index bd436effa6..d09e37ae4b 100755 --- a/src/test/shell/bazel/workspace_test.sh +++ b/src/test/shell/bazel/workspace_test.sh @@ -104,7 +104,7 @@ genrule( EOF bazel fetch //:test || fail "Fetch failed" bazel build //:test || echo "Expected build to succeed" - check_eq "12" "$(cat bazel-genfiles/test.out | tr -d '[[:space:]]')" + check_eq "12" "$(cat bazel-genfiles/test.out | tr -d '[:space:]')" } # Regression test for issue #724: NullPointerException in WorkspaceFile diff --git a/src/test/shell/integration/java_integration_test.sh b/src/test/shell/integration/java_integration_test.sh index 984eca739d..f2f69332ff 100755 --- a/src/test/shell/integration/java_integration_test.sh +++ b/src/test/shell/integration/java_integration_test.sh @@ -270,7 +270,7 @@ EOF cp ${PRODUCT_NAME}-bin/$pkg/java/hello/hello_deploy.jar $pkg/ugly/ $pkg/ugly/hello build.target build.time build.timestamp \ - main.class=hello.Hello "$expected_build_data" 2>&1 >>$TEST_log + main.class=hello.Hello "$expected_build_data" >> $TEST_log 2>&1 expect_log 'Hello, World!' } diff --git a/src/test/shell/integration/loading_phase_tests.sh b/src/test/shell/integration/loading_phase_tests.sh index 94bbd04d75..4227fe19e6 100755 --- a/src/test/shell/integration/loading_phase_tests.sh +++ b/src/test/shell/integration/loading_phase_tests.sh @@ -131,7 +131,7 @@ function test_all_help_topics_succeed() { awk '{print $1}') \ startup_options \ target-syntax) - for topic in ${topics[@]}; do + for topic in "${topics[@]}"; do bazel help $topic >$TEST_log 2>&1 || { fail "help $topic failed" expect_not_log . # print the log diff --git a/src/test/shell/integration/progress_reporting_test.sh b/src/test/shell/integration/progress_reporting_test.sh index 6027b5a406..f01199423f 100755 --- a/src/test/shell/integration/progress_reporting_test.sh +++ b/src/test/shell/integration/progress_reporting_test.sh @@ -25,7 +25,7 @@ set -eu # TODO(b/37617303): make tests UI-independent add_to_bazelrc "build --noexperimental_ui" -add_to_bazelrc "build --workspace_status_command="$(which true)" --nostamp" +add_to_bazelrc "build --workspace_status_command=$(which true) --nostamp" add_to_bazelrc "build --show_progress_rate_limit=-1" add_to_bazelrc "build --genrule_strategy=local" diff --git a/src/test/shell/integration_test_setup.sh b/src/test/shell/integration_test_setup.sh index 73f7c925e8..ba051d4b62 100755 --- a/src/test/shell/integration_test_setup.sh +++ b/src/test/shell/integration_test_setup.sh @@ -22,7 +22,7 @@ function print_message_and_exit() { CURRENT_SCRIPT=${BASH_SOURCE[0]} # Go to the directory where the script is running cd "$(dirname ${CURRENT_SCRIPT})" \ - || print_message_and_exit "Unable to access "$(dirname ${CURRENT_SCRIPT})"" + || print_message_and_exit "Unable to access $(dirname ${CURRENT_SCRIPT})" DIR=$(pwd) # Load the unit test framework diff --git a/src/test/shell/testenv.sh b/src/test/shell/testenv.sh index e9eee3355d..20f50948c9 100755 --- a/src/test/shell/testenv.sh +++ b/src/test/shell/testenv.sh @@ -472,7 +472,7 @@ function cleanup_workspace() { cd ${WORKSPACE_DIR} bazel clean >> $TEST_log 2>&1 # Clean up the output base - for i in $(ls); do + for i in *; do if ! is_tools_directory "$i"; then rm -fr "$i" fi diff --git a/src/tools/xcode/actoolwrapper/actoolwrapper.sh b/src/tools/xcode/actoolwrapper/actoolwrapper.sh index 1a55ac1a15..ddf7e43ad9 100755 --- a/src/tools/xcode/actoolwrapper/actoolwrapper.sh +++ b/src/tools/xcode/actoolwrapper/actoolwrapper.sh @@ -40,7 +40,7 @@ trap "rm -rf \"$TEMPDIR\"" EXIT TOOLARGS=() LASTARG="" -for i in $@; do +for i in "$@"; do if [ "$LASTARG" = "--output-partial-info-plist" ]; then touch "$i" fi diff --git a/src/tools/xcode/environment/environment_plist.sh b/src/tools/xcode/environment/environment_plist.sh index 057a9c8cdc..c1b5d869c4 100755 --- a/src/tools/xcode/environment/environment_plist.sh +++ b/src/tools/xcode/environment/environment_plist.sh @@ -25,7 +25,7 @@ set -eu -while [[ $# > 1 ]] +while [[ $# -gt 1 ]] do key="$1" diff --git a/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh b/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh index be72527566..ca026745f6 100755 --- a/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh +++ b/src/tools/xcode/ibtoolwrapper/ibtoolwrapper.sh @@ -56,7 +56,7 @@ TOOLARGS=() # By default, have ibtool compile storyboards (to stay compatible with the # native rules). If the command line includes "--link", we use it instead. ACTION=--compile -for i in $@; do +for i in "$@"; do if [ -e "$i" ]; then if [[ "$i" == *.zip ]]; then unzip -qq "$i" -d "$LINKDIR" -- cgit v1.2.3