--- bin/sentieon.orig	2018-01-12 15:21:17.294463939 -0500
+++ bin/sentieon	2018-01-12 15:22:12.778466380 -0500
@@ -1,13 +1,16 @@
-#!/bin/sh
+#!/bin/bash
 OS=$(uname)
-case "$0" in
-/*)     bin_dir=$(dirname "$0");;
-*)      bin_dir=$(dirname "$(pwd)/$0");;
-esac
-case "$bin_dir" in
-*/.)    install_dir=$bin_dir.;;
-*)      install_dir=$(dirname $bin_dir);;
-esac
+# Find original directory of bash script, resovling symlinks
+# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+    DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+    SOURCE="$(readlink "$SOURCE")"
+    [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+done
+bin_dir="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+install_dir=$(dirname "$bin_dir")
+
 lib_dir=$install_dir/lib
 libexec_dir=$install_dir/libexec
 
