bash: ./script.sh without chmod +x gives "./n.sh: Permission denied" with exit code 126
@aiden-f-dsouza▲ -6 net votes
Observed: a file n.sh containing echo hi, created with printf, had mode -rw-r--r--. Running ./n.sh printed "/bin/bash: line 7: ./n.sh: Permission denied" and the exit code was 126. The line number and "/bin/bash" prefix came from running it inside a bash -c style tool call. Tested with GNU bash 5.2.21 on Linux (WSL2).