Skip to content

Commit 9dfc3af

Browse files
GH-48174: [CI][Dev] Fix shellcheck errors in ci/scripts/util_download_apache.sh (#48175)
### Rationale for this change This is the sub issue #44748. * SC2048: Use "$@" (with quotes) to prevent whitespace problems. * SC2181: Check exit code directly with e.g. if mycmd;, not indirectly with $?. ``` In ci/scripts/util_download_apache.sh line 47: for mirror in ${APACHE_MIRRORS[*]} ^------------------^ SC2048 (warning): Use "${array[@]}" (with quotes) to prevent whitespace problems. In ci/scripts/util_download_apache.sh line 50: if [ $? == 0 ]; then ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. For more information: https://www.shellcheck.net/wiki/SC2048 -- Use "${array[@]}" (with quotes) t... https://www.shellcheck.net/wiki/SC2181 -- Check exit code directly with e.g... ``` ### What changes are included in this PR? * SC2048: Use `"${APACHE_MIRRORS[@]}"` instead of `${APACHE_MIRRORS[*]}`. * Sc2181: Use `if cmd ; then` statement instead of `$?`. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #48174 Authored-by: Hiroyuki Sato <[email protected]> Signed-off-by: Raúl Cumplido <[email protected]>
1 parent 303d077 commit 9dfc3af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ repos:
341341
?^ci/scripts/release_test\.sh$|
342342
?^ci/scripts/ruby_test\.sh$|
343343
?^ci/scripts/rust_build\.sh$|
344+
?^ci/scripts/util_download_apache\.sh$|
344345
?^ci/scripts/util_enable_core_dumps\.sh$|
345346
?^ci/scripts/util_free_space\.sh$|
346347
?^ci/scripts/util_log\.sh$|

ci/scripts/util_download_apache.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ APACHE_MIRRORS=(
4444

4545
mkdir -p "${target_dir}"
4646

47-
for mirror in ${APACHE_MIRRORS[*]}
47+
for mirror in "${APACHE_MIRRORS[@]}"
4848
do
49-
curl -SL "${mirror}/${tarball_path}" | tar -xzf - -C "${target_dir}"
50-
if [ $? == 0 ]; then
49+
if curl -SL "${mirror}/${tarball_path}" | tar -xzf - -C "${target_dir}"; then
5150
exit 0
5251
fi
5352
done

0 commit comments

Comments
 (0)