You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2024/12/18 05:09:15 UTC
(cloudberry) 01/08: Try to lookup commands by $PATH before iterating over hardcoded paths. (#13361)
This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit a4179417310f16ede626db787f75c06a72504616
Author: Xing Guo <hi...@gmail.com>
AuthorDate: Tue Apr 26 14:15:21 2022 +0800
Try to lookup commands by $PATH before iterating over hardcoded paths. (#13361)
To my surprise, gp_bash_functions.sh finds available commands by
iterating over hardcoded paths. This patch helps teach the script
find commands by using the `which` command.
---
gpMgmt/bin/lib/gp_bash_functions.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gpMgmt/bin/lib/gp_bash_functions.sh b/gpMgmt/bin/lib/gp_bash_functions.sh
index 9dcda93791..c0c2439187 100755
--- a/gpMgmt/bin/lib/gp_bash_functions.sh
+++ b/gpMgmt/bin/lib/gp_bash_functions.sh
@@ -40,6 +40,11 @@ GP_UNIQUE_COMMAND=gpstart
findCmdInPath() {
cmdtofind=$1
+ CMD=`which $cmdtofind`
+ if [ $? -eq 0 ]; then
+ echo $CMD
+ return
+ fi
for pathel in ${CMDPATH[@]}
do
CMD=$pathel/$cmdtofind
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org