lzyxx77 commented on code in PR #510:
URL: 
https://github.com/apache/incubator-hugegraph-toolchain/pull/510#discussion_r1320730841


##########
hugegraph-loader/assembly/static/bin/hugegraph-loader.sh:
##########
@@ -16,11 +16,11 @@
 # under the License.
 #
 abs_path() {
-    SOURCE="${BASH_SOURCE[0]}"
-    while [[ -h "$SOURCE" ]]; do
+    SOURCE="$0"
+    while [ -h "$SOURCE" ]; do
         DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
         SOURCE="$(readlink "$SOURCE")"
-        [[ ${SOURCE} != /* ]] && SOURCE="$DIR/$SOURCE"
+        [ "${SOURCE}" != /* ] && SOURCE="$DIR/$SOURCE"

Review Comment:
   > maybe it just caused by `"${BASH_SOURCE[0]}"`?
   
   thinks for your reply!However, when I only modify "${BASH_SOURCE[0]}" and 
then execute it with sh, it still fails. The reason in follow:
   
   In Ubuntu, /bin/sh is by default symlinked to dash, which is a different 
shell than bash. This change was made to improve script execution speed, as 
bash is more complex. dash was ported from NetBSD to Linux and recommended for 
use as /bin/dash for faster script execution. dash is faster than bash but has 
fewer features, aligning more closely with the POSIX standard. Specifically, in 
this context, the [[ construct is an extension of bash used for more advanced 
conditional testing, and dash does not support it. Therefore, when running 
scripts in the sh environment, it results in the [[: not found error.
   
   Of course, you can also change the symlink for sh in your Ubuntu system to 
point to bash so that you don't need to modify sh scripts.



##########
hugegraph-loader/assembly/static/bin/hugegraph-loader.sh:
##########
@@ -16,11 +16,11 @@
 # under the License.
 #
 abs_path() {
-    SOURCE="${BASH_SOURCE[0]}"
-    while [[ -h "$SOURCE" ]]; do
+    SOURCE="$0"
+    while [ -h "$SOURCE" ]; do
         DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
         SOURCE="$(readlink "$SOURCE")"
-        [[ ${SOURCE} != /* ]] && SOURCE="$DIR/$SOURCE"
+        [ "${SOURCE}" != /* ] && SOURCE="$DIR/$SOURCE"

Review Comment:
   > maybe it just caused by `"${BASH_SOURCE[0]}"`?
   
   thinks for your reply!However, when I only modify "${BASH_SOURCE[0]}" and 
then execute it with sh, it still fails. The reason in follow:
   
   In Ubuntu, /bin/sh is by default symlinked to dash, which is a different 
shell than bash. This change was made to improve script execution speed, as 
bash is more complex. dash was ported from NetBSD to Linux and recommended for 
use as /bin/dash for faster script execution. dash is faster than bash but has 
fewer features, aligning more closely with the POSIX standard. Specifically, in 
this context, the [[ construct is an extension of bash used for more advanced 
conditional testing, and dash does not support it. Therefore, when running 
scripts in the sh environment, it results in the [[: not found error.
   
   Of course, you can also change the symlink for sh in your Ubuntu system to 
point to bash so that you don't need to modify sh scripts.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to