Symlinks are different than aliases, although they seem to serve the same purpose (more or less/I think). I need to be able to tell if a file is an alias, and
if [ -h /path/to/file ]
doesn’t work. Is there anything like this for aliases? Google was most unhelpful as aliases are apparently the name for something else in bash altogether.
Thanks!
The Finder stores the information that a file is an alias in the ResourceFork of the file. To read this metadata, I would use spotlight to determine the kind of the file; the following command will return the kind of the file, so you could then compare it in an if-statement.
An other way would incorporate Applescript, which is executable on the command line via osascript. To return the kind of a file, run: