Retrieving the "Version" attribute of an OSX Application file via Bash I was initially attempting to do this in Java using the UserDefinedFileAttributeView class but it turns out that is only available on Windows computers (This is being run on OSX)

So I switched gears with the hope that retrieving the information via a script would be the simpler route but it seems to not be as straight forward as I expected.

How would one go about retrieving an Application file's version number (file attribute) using Bash?

I've already looked into stat but that only returns the basic file information.
I also looked into xattr but I couldn't get that to return the "Version" attribute.

Any pointers would be greatly appreciated!
You can use defaults to fetch specific keys:

VERSION=$(defaults read /Applications/AppName.app/Contents/Info.plist CFBundleShortVersionString)
echo $VERSION