Check if a file is executable
问题 I am wondering what's the easiest way to check if a program is executable with bash, without executing it ? It should at least check whether the file has execute rights, and is of the same architecture (for example, not a windows executable or another unsupported architecture, not 64 bits if the system is 32 bits, ...) as the current system. 回答1: Take a look at the various test operators (this is for the test command itself, but the built-in BASH and TCSH tests are more or less the same). You