nicoloboschi commented on code in PR #16332:
URL: https://github.com/apache/pulsar/pull/16332#discussion_r921939431


##########
bin/pulsar-shell:
##########
@@ -18,7 +18,19 @@
 # under the License.
 #
 
-BINDIR=$(dirname "$0")
+# need this for relative symlinks
+PRG="$0"
+while [ -h "$PRG" ] ; do
+  ls=`ls -ld "$PRG"`
+  link=`expr "$ls" : '.*-> \(.*\)$'`
+  if expr "$link" : '/.*' > /dev/null; then
+    PRG="$link"
+  else
+    PRG="`dirname "$PRG"`/$link"
+  fi
+done

Review Comment:
   That's a good question.
   This is needed when the binary is a symlink otherwise it won't be able to 
find the actual pulsar home directory.
   For example, if you install the shell with homebrew, a symlink is used. 
   
   To be honest I didn't invented any here, I just copied it from Apache Maven: 
 
https://github.com/apache/maven/blob/f05397a88dc4178fff7ac7d307797cd54db3bef9/apache-maven/src/assembly/shared/mvnvalidate#L1-L13



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to