Open vj23a opened 4 hours ago
Sure, test -x
tests if a file exists and appears to be executable. It returns an exit code of 0 when the test succeeds.
~ $ touch file.exe
~ $ ls -l file.exe
-rwxrwxr-x 1 rmy rmy 0 Oct 26 15:05 file.exe
~ $ if test -x file.exe; then echo 'it exists'; fi
it exists
~ $
Of course, an empty file isn't really executable:
~ $ ./file.exe
sh: ./file.exe: Exec format error
~ $
It just appears to be executable to test
because busybox-w32 treats any file with the extension .exe
as having execute permission.
Nice to meet you. Can't you check the existence of file.exe using test -x file?
Example:
Please