[SPARK-35373][BUILD][FOLLOWUP] Fix "binary operator expected" error on build/mvn

### What changes were proposed in this pull request?
change $(command -v curl) to "$(command -v curl)"

### Why are the changes needed?
We need change $(command -v curl) to "$(command -v curl)" to make sure it work when `curl` or `wget` is uninstall. othewise raised:
`build/mvn: line 56: [: /root/spark/build/apache-maven-3.6.3-bin.tar.gz: binary operator expected`

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
```
apt remove curl
rm -f build/apache-maven-3.6.3-bin.tar.gz
rm -r build/apache-maven-3.6.3-bin
mvn -v
```

Closes #32608 from Yikun/patch-6.

Authored-by: Yikun Jiang <yikunkero@gmail.com>
Signed-off-by: Sean Owen <srowen@gmail.com>
This commit is contained in:
Yikun Jiang 2021-05-20 12:25:23 -05:00 committed by Sean Owen
parent 2bd32548f5
commit 3c3533d845

View file

@ -51,7 +51,7 @@ install_app() {
# check if we already have the tarball # check if we already have the tarball
# check if we have curl installed # check if we have curl installed
# download application # download application
if [ ! -f "${local_tarball}" -a $(command -v curl) ]; then if [ ! -f "${local_tarball}" -a "$(command -v curl)" ]; then
echo "exec: curl ${curl_opts} ${remote_tarball}" 1>&2 echo "exec: curl ${curl_opts} ${remote_tarball}" 1>&2
curl ${curl_opts} "${remote_tarball}" > "${local_tarball}" curl ${curl_opts} "${remote_tarball}" > "${local_tarball}"
if [ ! -z "${checksum_suffix}" ]; then if [ ! -z "${checksum_suffix}" ]; then
@ -60,7 +60,7 @@ install_app() {
fi fi
fi fi
# if the file still doesn't exist, lets try `wget` and cross our fingers # if the file still doesn't exist, lets try `wget` and cross our fingers
if [ ! -f "${local_tarball}" -a $(command -v wget) ]; then if [ ! -f "${local_tarball}" -a "$(command -v wget)" ]; then
echo "exec: wget ${wget_opts} ${remote_tarball}" 1>&2 echo "exec: wget ${wget_opts} ${remote_tarball}" 1>&2
wget ${wget_opts} -O "${local_tarball}" "${remote_tarball}" wget ${wget_opts} -O "${local_tarball}" "${remote_tarball}"
if [ ! -z "${checksum_suffix}" ]; then if [ ! -z "${checksum_suffix}" ]; then