Is there a (relatively) simple way to test if an executable not only exists, but is valid?
By valid, I mean that an x86_64 Mach-O (OS X) executable will not run on an ARM Raspberry Pi. However, simply running
tool-osx || tool-rpi works on OS X, where the executable runs, but does not fall back to
tool-rpi when the x86_64 fails.
How can I fall back to another executable when one is invalid for the processor architecture?