Make greadlink detection work properly.

Use a function, because aliases appear not to work inside a command
substitution.
parent 3e3c8cf1
......@@ -21,9 +21,9 @@
set -euo pipefail
if [[ $(uname) = Darwin ]] && which greadlink >/dev/null 2>&1; then
alias readlink=greadlink
readlink() { greadlink "$@"; }
fi
projectDir=$(greadlink -f "$0")
projectDir=$(readlink -f "$0")
projectDir=$(dirname "$projectDir")
declare -r projectDir
. "$projectDir/common.sh"
......
......@@ -21,9 +21,9 @@
set -euo pipefail
if [[ $(uname) = Darwin ]] && which greadlink >/dev/null 2>&1; then
alias readlink=greadlink
readlink() { greadlink "$@"; }
fi
projectDir=$(greadlink -f "$0")
projectDir=$(readlink -f "$0")
projectDir=$(dirname "$projectDir")
declare -r projectDir
. "$projectDir/common.sh"
......
......@@ -26,9 +26,9 @@
set -euo pipefail
if [[ $(uname) = Darwin ]] && which greadlink >/dev/null 2>&1; then
alias readlink=greadlink
readlink() { greadlink "$@"; }
fi
projectDir=$(greadlink -f "$0")
projectDir=$(readlink -f "$0")
projectDir=$(dirname "$projectDir")
projectDir=$(dirname "$projectDir")
declare -r projectDir
......
......@@ -22,12 +22,12 @@
set -euo pipefail # "Unofficial Bash strict mode."
if [[ $(uname) = Darwin ]] && which greadlink >/dev/null 2>&1; then
alias readlink=greadlink
readlink() { greadlink "$@"; }
fi
# Merging these lines won't cause the command to fail (for set -e).
projectDir=$(git rev-parse --git-dir)
projectDir=$(greadlink -f "$projectDir")
projectDir=$(readlink -f "$projectDir")
projectDir=$(dirname "$projectDir")
declare -r projectDir
cd "$projectDir"
......
......@@ -22,9 +22,9 @@
set -euo pipefail
if [[ $(uname) = Darwin ]] && which greadlink >/dev/null 2>&1; then
alias readlink=greadlink
readlink() { greadlink "$@"; }
fi
qtahDir=$(greadlink -f "$0")
qtahDir=$(readlink -f "$0")
qtahDir=$(dirname "$qtahDir")
qtahDir=$(dirname "$qtahDir")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment