]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts/build_utils: check retval of "command" 1887/head
authorKefu Chai <kchai@redhat.com>
Sat, 31 Jul 2021 06:11:05 +0000 (14:11 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 31 Jul 2021 06:12:53 +0000 (14:12 +0800)
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 <kchai@redhat.com>
scripts/build_utils.sh

index 5eb7c51ad21d0179a68b3de2f7edc5574a16b2fb..3512c85c6dc4cf6ae6b1e269bbb95f2a13ddd59f 100644 (file)
@@ -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