I am trying to use an sh file to easily start a screen with my minecraft server console. I named this file mc.sh. I have another sh file in the same directory as mc.sh that runs fine.

Here is what is in mc.sh:

screen -S minecraft java -Xms1024M -Xmx1024M -jar spigot.jar nogui

Here is what is in the other sh file:

java -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot.jar

The error message i get is -bash: ./mc.sh: Permission denied. The permissions for mc.sh are -rw-rw-r-- 1

  • Put 4 spaces in front of the line of code and it will format correctly even with a # ;) Please also show the permissions of "mc.sh" (ls -l mc.sh from the directory). – Rinzwind Jul 21 '15 at 6:39
  • You could start by adding the error message you get, and also the output of "ls -l *.sh" in the directory you have the shell scripts. (30 seconds late!😊) – mgor Jul 21 '15 at 6:40

The permissions don't have the execute bit set, so bash won't execute the script. You can set the bit and execute the script:

chmod u+x mc.sh

or let bash execute it for you:

bash mc.sh
| improve this answer | |

You can open the terminal (press Ctrl + Alt + T) and cd to the target directory:

cd /path_to_target

To give the file "your_file_name" permission to execute:

chmod +x your_file_name

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.