Using the following snippet it creates an invalid symlink. But according to other answers it should work fine.
# make a temp dir and save path to var.
# set dir (mktemp -d) # fish shell only!
dir=$(mktemp -d) # bash/zsh
cd $dir
mkdir a b
echo 'text file' > a/file.txt
ln -s a/file.txt b/
open .
When you see the symlink in Finder it doesn't recognise the file type in Quick Preview and when you open it Finder complains 'the original item cannot be found'.
If you use absolute paths everything works fine. See below:
rm b/file.txt
ln -s $dir/a/file.txt $dir/b/
open .
Then you can see symlink is correctly make and you can even read the file content in Quick Preview.
How is this happening? I've checked that ln is /bin/ln
. I'm on macOS Catalina 10.15.7 (19H2).