It's a well-known fact that if one wants to execute a script in shell, then the script needs to have execute permissions:
$ ls -l total 4 -rw-r--r-- 1 user user 19 Mar 14 01:08 hw $ ./hw bash: ./hw: Permission denied $ /home/user/hw bash: /home/user/hw: Permission denied $
However, it is possible to execute this script with
sh <scriptname>, etc:
$ bash hw Hello, World! $
This means that basically one can execute a script file, even if it only has read permissions. This maybe is a silly question, but what is the point of giving execute permissions to a script file? Is it solely because in order for a program to run it needs to have execute permissions, but it actually doesn't add security or any other benefits?