Every time I need to run a shell script, I need to enter
chmod +x <filename>
For example, if I want to run this sample script named "run",
#!/bin/bash
javac --version
I have to go into my terminal
chmod +x run
./run
Is there a way to allow Z shell (zsh
) always to run these scripts without having to enter chmod +x <filename>
?
zsh
does not run the script unless you explicitly tell it to withzsh ./run
. If you just do./run
, the shell mentioned in the shebang (here,#!/bin.bash
) is the shell that will run the script.