Skip to content

`abspath=$(readlink -f "$file")` doesn't work in Animator on some macOS

When I imported the sh script into Animator.app, and run it as an app, I found the sh code abspath=$(readlink -f "$file") always results in abspath='', no matter what $file is. This causes that no soft link can be created and opened by Obsidian.

I found the default readlink in my macbook (MacOS 10.15.7) performs different from readlink in linux:

> where readlink
/usr/bin/readlink

> /usr/bin/readlink -f ./test.md
/usr/bin/readlink: illegal option -- f
usage: readlink [-n] [file ...]

After that, I tried to install greadlink by brew install coreutils, and modified abspath=$(readlink -f "$file") to abspath=$(/usr/local/bin/greadlink -f "$file"). Then everything works well, the soft link can be created and opened.

This may help you to fix this bug.