From: Kefu Chai Date: Sat, 31 Jul 2021 06:11:05 +0000 (+0800) Subject: scripts/build_utils: check retval of "command" X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=370776b7f3599ad62f6bce07c1f0f9743324fd21;p=ceph-build.git scripts/build_utils: check retval of "command" instead of checking the output of `command`, check its retval. this is a more idiomatic way of using this tool. and redirect its output to /dev/null. no news is good news. Signed-off-by: Kefu Chai --- diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index 5eb7c51ad..3512c85c6 100644 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -102,9 +102,9 @@ create_virtualenv () { if [ -d $path ]; then echo "Will reuse existing virtual env: $path" else - if [ $(command -v python3) ]; then + if command -v python3 > /dev/null; then virtualenv -p python3 $path - elif [ $(command -v python2.7) ]; then + elif command -v python2.7 > /dev/null; then virtualenv -p python2.7 $path else virtualenv -p python $path