Received: from eggs.gnu.org ([2001:4830:134:3::10]:58999) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyec4-0000N6-2s for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xyebx-000838-RF for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52000) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyebt-00081l-Jo for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:13 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sBAAZ9w8021625 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Dec 2014 05:35:09 -0500 From: Kevin Wolf Date: Wed, 10 Dec 2014 11:33:54 +0100 Message-Id: <1418207679-32260-29-git-send-email-kwolf@redhat.com> In-Reply-To: <1418207679-32260-1-git-send-email-kwolf@redhat.com> References: <1418207679-32260-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 28/73] tests: Use "command -v" instead of which(1) in shell scripts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Fam Zheng When which(1) is not installed, we would complain "perl not found" because it's the first set_prog_path check. The error message is wrong. Fix it by using "command -v", a native way to query the existence of a command. Suggested-by: Eric Blake Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Message-id: 1416380832-9697-1-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- tests/qemu-iotests/common | 8 ++++---- tests/qemu-iotests/common.config | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 9e12bec..bc27f6a 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -289,10 +289,10 @@ testlist options if [ ! -z "$DISPLAY" ] then - which xdiff >/dev/null 2>&1 && diff=xdiff - which gdiff >/dev/null 2>&1 && diff=gdiff - which tkdiff >/dev/null 2>&1 && diff=tkdiff - which xxdiff >/dev/null 2>&1 && diff=xxdiff + command -v xdiff >/dev/null 2>&1 && diff=xdiff + command -v gdiff >/dev/null 2>&1 && diff=gdiff + command -v tkdiff >/dev/null 2>&1 && diff=tkdiff + command -v xxdiff >/dev/null 2>&1 && diff=xxdiff fi ;; diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config index bd6790b..91a5ef6 100644 --- a/tests/qemu-iotests/common.config +++ b/tests/qemu-iotests/common.config @@ -47,7 +47,7 @@ export PWD=`pwd` # $1 = prog to look for, $2* = default pathnames if not found in $PATH set_prog_path() { - p=`which $1 2> /dev/null` + p=`command -v $1 2> /dev/null` if [ -n "$p" -a -x "$p" ]; then echo $p return 0 -- 1.8.3.1