This is just a question of permissions. If a file has execute permissions, that just means users are allowed to execute it. Whether they will be successful is another matter. In order for a file to be executed, the user executing it must have the right to do so and the file needs to be a valid executable. The permissions shown by ls
only affect the first part, permission, and have no bearing on the rest.
For instance:
$ cat file.csv
a,silly,file
$ chmod a+x file.csv
$ ls -l file.csv
-rwxr-xr-x 1 terdon terdon 13 May 29 15:22 file.csv
This file now has execute permissions (see the 3 x
in the permissions string -rwxr-xr-x
). But if I try to execute it, I will get an error:
$ ./file.csv
./file.csv: line 1: a,silly,file: command not found
That is because the shell is trying to execute the file as a shell script, and there are no valid shell commands in it, so it fails.