|
#1
| ||||
| ||||
|
I'm working on learning shell scripting, and I made a shell script named helloworld.sh with the following code: Code: #!/bin/sh echo Hello World cd ~/Desktop ./helloworld.sh When I do that, I get the following message: -bash: ./helloworld.sh: Permission denied What's the problem? How do I run my shell script? |
|
#2
| |||
| |||
|
The error message tells it. You do not have permission. Ok, since you created the file, it is your file and you have permission to read and edit it, but not to execute it. Normally text files are not to be executed, so you have to make it executable. Type: chmod u+x ./helloworld.sh and then you should be able to execute the file. The chmod -command changes files permissions. "x" means that it can be executed. u+x means that your (u is for user) permission is changed, but not others. |
|
#3
| ||||
| ||||
| Quote:
chmod x ./helloworld will it change permissions for everyone? |
|
#4
| |||
| |||
|
No, chmod x ./helloworld does not, but chmod +x ./helloworld does. (I guess the reason for + is that you can use chmod -x ./helloworld to remove the rights.)
|
![]() |
| Bookmarks |
| Tags |
| shell script problem |
| Thread Tools | |
|
|