osx - Determine if file location is an alias in bash scripting -


symlinks different aliases, although seem serve same purpose (more or less/i think). need able tell if file alias, ,

if [ -h /path/to/file ] 

doesn't work. there aliases? google unhelpful aliases apparently name else in bash altogether.

thanks!

the finder stores information file alias in resourcefork of file. read metadata, use spotlight determine kind of file; following command return kind of file, compare in if-statement.

 mdls -raw -name kmditemkind /path/to/test.pdf          returns  pdf (portable document format)  mdls -raw -name kmditemkind /path/to/test.pdf\ alias   returns  alias 

an other way incorporate applescript, executable on command line via osascript. return kind of file, run:

tell application "finder" kind of ((posix file "/path/to/test.pdf\ alias") alias) 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -