
# ./helloWorld.sh
bash: ./helloWorld.sh: Permission denied
If you are trying to run a Bash (.sh) script on your Terminal and you get a "Permission denied" error then most likely is that the script file does not have the execute permissions. You can check that by the ls command
# ls -l helloWorld.sh
-rw-r--r-- 1 root root 30 Apr 5 10:43 helloWorld.sh
Let's read the permissions out,
r = represents read permission.
w = represents write permission.
x = represents executable permission.
- => This is not a directory
r => owner has read permission
w => owner has write permission
- => owner does not have execute permission
r => group has read permission
- => group does not have write permission
- => group does not have execute permission
r => group has read permission
- => group does not have write permission
- => group does not have execute permission
As you can see we do not have the execute permission!
Fix: Add execute permission using chmod command# chmod +x helloWorld.sh
- How to Assign Bash Command to Variable
- How to Kill a port using bash terminal command?
- Bash For Loop Example
- bash: netstat: command not found
- Bash getopts Command Example
- How to fix bash ping command not found error
- [Fix] bash: script.sh: /bin/bash^M: bad interpreter: No such file or directory
- [fix] bash: ssh: command not found
- Fix bash: script.sh: Permission denied Error
- bash: ls command to see list files in current directory all subdirectories
- How to see Created Accessed Modified and Changed dates of a file using bash terminal command
- How to use Autocomplete and Autosuggestion in Shell Commands
- Bash Hello World! Script Tutorial
- Install Bash Completion on macOS
- bash get year 2021 calendar
- How to create new user account in Windows bash
- Bash command to wait for seconds
- Know Bash shell version command
- How to start or open a new bourne-again shell (bash) session on Windows using Command Line CMD
- How to check your IP using bash for Windows?
- Bash Script to prefix files with sequential numbers in a directory
- How to Compare Strings in Bash
- Command to Sort File In Reverse Order [Unix/Linux/macOS]
- How to know the current shell you are logged in?
- List all Username and User ID using Bash Command
- JSON Tutorial: List of Lessons - Json-Tutorial
- SQLite Error: unknown command or invalid arguments: open. Enter .help for help - Android
- How to create a Java Project as a Git Repository with IntelliJ - Java
- Simple Crossword Puzzle example using Pure HTML, CSS and JavaScript - Html
- Office.com downloading zero byte file name prelanding on Safari browser - Windows
- How to show or hide columns in SharePoint Online List Library from - SharePoint
- Step-by-Step: How to install Flutter in Android Studio - Android-Studio
- Fix Python WARNING: You are using pip version 19 however version 21 is available - PIP