open-discussion > runROBEX with BSD or OS X (readlink -f issue)
Showing 1-2 of 2 posts
Jul 31, 2017 04:07 PM | LabNuero CogDevel - UPMC
runROBEX with BSD or OS X (readlink -f issue)
OS X (Mac) uses BSD's readlink which does not have the -f option
used by runROBEX.sh
I'm getting around this by redefining readlink at the top of the runROBEX.sh file
realreadlink=$(which readlink)
[ -z "$realreadlink" ] && exiterr "the 'readlink' program is not installed on your system. $0 cannot be run!"
if ! readlink -f test >/dev/null 2>/dev/null; then
readlink() {
[ "$1" == "-f" ] && shift # skip to the next thing if we have "-f"
path="$(cd $(dirname "$1");pwd)"
rp=$($realreadlink "$path") # returns empty if not a link
[ -z "$rp" ] && rp="$path"
fullpath="$path/$(basename "$1")"
echo "$fullpath"
}
fi
readlink: illegal option -- f
I'm getting around this by redefining readlink at the top of the runROBEX.sh file
realreadlink=$(which readlink)
[ -z "$realreadlink" ] && exiterr "the 'readlink' program is not installed on your system. $0 cannot be run!"
if ! readlink -f test >/dev/null 2>/dev/null; then
readlink() {
[ "$1" == "-f" ] && shift # skip to the next thing if we have "-f"
path="$(cd $(dirname "$1");pwd)"
rp=$($realreadlink "$path") # returns empty if not a link
[ -z "$rp" ] && rp="$path"
fullpath="$path/$(basename "$1")"
echo "$fullpath"
}
fi
Sep 18, 2017 03:09 PM | John Muschelli
runROBEX with BSD or OS X (readlink -f issue)
Having the same problem - is there any resolution on this?