In the terminal, I can use readlink on a symlink and it prints the target path of the symlink. E.g.
ln -s original.txt symlink.txt
readlink symlink.txt # prints original.txt
How do I do this for Mac alias? I know the path is embedded in the resource fork, because the xattr command will display it in a raw format mixed with other data:
xattr -p -l com.apple.ResourceFork alias_file
However, I don't know enough about this format to extract it. I found the perl Mac::Files man page, but it has no examples, and Google was no help with it.
Maybe there's a way to use osascript to do it, similar to this answer?