Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.2.0, 1.3.0
-
None
-
None
-
Knox
Korn Shell
Description
APP_BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
When the script is running in Korn shell, ${BASH_SOURCE[0]} is always empty and this is because ${BASH_SOURCE[0]} is valid only for Bash shell. Thus, the path is not constructed correctly. Later on when we have any other installation scripts running, it is unable to find gateway.sh since the Bash Source is not inclusive of Korn shell path to the gateway.sh.
However we did find a work around for it. A simple script has to be added into the gateway.sh script. It basically checks for two kinds of shells: either Bash or Korn and then adds the path according to whatever the type is. Here's what the code snippet looks like:
if [ $SHELL == '/bin/bash' ] || [ $SHELL == '/bin/sh' ] then THIS_SCRIPT=${BASH_SOURCE[0]} echo $THIS_SCRIPT elif [ $SHELL == '/bin/ksh' ] then THIS_SCRIPT=${.sh.file} echo $THIS_SCRIPT else echo NO MATCH. fi APP_BIN_DIR="$( cd "$( dirname ${THIS_SCRIPT} )" && pwd )"