From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2D9B021161690 for ; Mon, 1 Oct 2018 20:36:14 -0700 (PDT) Received: from localhost.localdomain (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (NOT encrypted); Tue, 02 Oct 2018 05:36:11 +0200 From: Gary Lin To: edk2-devel@lists.01.org Cc: Liming Gao , Yonghong Zhu Date: Tue, 2 Oct 2018 11:35:41 +0800 Message-Id: <20181002033541.17076-1-glin@suse.com> X-Mailer: git-send-email 2.18.0 Subject: [PATCH] BaseTools/edksetup.sh: Handle the return value from grep X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2018 03:36:15 -0000 When SetupPython3() parses the possible python binary paths, it uses `grep "[[:digit:]]$"` to filter the python versions in the file name. Since grep would return 1 when the last character of the file name is not a digit, OvmfPkg/build.sh would fail immediately when the function is handling some cases, e.g. "python3:". This commit adds `|| true` to the grep command to make sure the command never returns 1 in any condition. [NOTE: For the python3 branch] Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Gary Lin Cc: Liming Gao Cc: Yonghong Zhu --- edksetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edksetup.sh b/edksetup.sh index 5ff3be19fb2f..d4e577e60781 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -115,7 +115,7 @@ function SetupPython3() { for python in $(whereis python3) do - python=$(echo $python | grep "[[:digit:]]$") + python=$(echo $python | grep "[[:digit:]]$" || true) python_version=${python##*python} if [ -z "${python_version}" ];then continue -- 2.18.0