From 9233d8d6c02992f405f2f7bca9f0db5fa99ace3e Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Fri, 26 Jul 2019 13:49:44 +0200 Subject: [PATCH] macOS: try greadlink -f, then readlink -f, then readlink and warn about it --- gitwatch.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gitwatch.sh b/gitwatch.sh index d400993..e0c14e3 100755 --- a/gitwatch.sh +++ b/gitwatch.sh @@ -185,7 +185,15 @@ trap "cleanup" EXIT # make sure the timeout is killed when exiting script if [ "$(uname)" != "Darwin" ]; then IN=$(readlink -f "$1") else - IN=$(greadlink -f "$1") + if is_command "greadlink"; then + IN=$(greadlink -f "$1") + else + IN=$(readlink -f "$1") + if [ $? -eq 1 ]; then + echo "Seems like your readlink doesn't support '-f'. Running without. Please 'brew install coreutils'." + IN=$(readlink "$1") + fi + fi; fi;