1

I hope that my post is acceptable although I am actually running lubuntu, not ubuntu.

I am trying to create an executable file but I am having difficulties.

I created a script with a text editor and saved it onto my desktop:

#!/usr/bin
echo hello

I ran sudo chmod +xand sudo chmod 755 on it. When I double click on it I get a dialogue box asking me either to execute or execute in terminal as follows:

enter image description here

When I click on execute, I get Failed to execute child process "/home/name/Desktop/helloworld" (Permission denied)

If I click on execute in terminal, I just get a new terminal window with name@macbook:~/Desktop$ but no sign of my script.

Nick
  • 13

1 Answers1

1

This is most likely caused by your Shebang - the #!/usr/bin line in your script.

The Shebang in a script is what tells Ubuntu/Linux/BASH what command to run to interpret or execute the script.

Python script shebangs are usually #!/usr/bin/env python or #!/usr/bin/python (says to run the script with the Python interpreter) and BASH scripts (like yours is) are usually #!/bin/bash (says to run the script in a BASH terminal) or #!/bin/sh (run the script with sh or shell).

Because /usr/bin is a directory, not a program/sym-link to a program, nothing can actually be executed.

Try changing that initial line to be #!/bin/bash:

#!/bin/bash
echo hello