From 8970e71d50e1cafda7270bfee9e0f3940f7ffb7a Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Fri, 23 Jan 2015 23:38:46 +0100 Subject: [PATCH] Fixed: installation on OS X fails --- install | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install b/install index b959ab5..213679c 100755 --- a/install +++ b/install @@ -8,7 +8,13 @@ if [ ! -r ~/.zshrc ]; then exit 1 fi -DIR=$(dirname $(readlink -f $0)) ; +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 +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" # appends the string to ~/.zshrc file cat >> ~/.zshrc << EOF