shell scripting & execution rights



~1 min read


153 words

I was writing a small bash script the other day when I wanted to test it.

I went to try to execute the script and received a permission denied error:

$ ./
zsh: permission denied: ./

Looking at permissions, I could see that there were not execution rights for the file:

$ ls -la
-rw-r--r--     1 stephen  staff   671B Nov 19 13:28

It turns out that’s not a default right for a file. To fix that, you can change the file’s permissions with CHMOD1:

$ chmod +x
$ ls -la
-rwxr-xr-x     1 stephen  staff   671B Nov 19 13:28


  • 1 While I used the -x flag only, there are other flags. The flags are: user (u), group (g), other (o), and all (a). For example, to change the execution rights for only users, you could do:
$ chmod u+x

Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!