1

I am using debian and xterm.

I have created a file 'run.sh' containing the following:

java -cp bin Main
read -n1 -r ip "Press any key to continue..." key

In Properties window I gave it permission to run as program.

Double clicking the file does nothing. Right click 'Execute' does nothing. Open-with UXTerm does nothing.

If I open a terminal in the same directory and type

java -cp bin Main

then it will run, but the shell script file never works.

What am I doing wrong here?

1
  • 1
    try launching same script from terminal and see the error message Commented Aug 18, 2014 at 19:26

2 Answers 2

2

Your shell script file doesn't seem to have a shebang line,

#!/usr/bin/env bash
java -cp bin Main
read -n1 -r ip "Press any key to continue..." key

and make sure it has a execute permissions

chmod a+x <script_file>
Sign up to request clarification or add additional context in comments.

Comments

0

You need to add a shebang line at the top of your file: #!/usr/bin/bash. This tells the operating system that the file is in fact a bash executable rather than a normal file. Alternatively, execute the script by entering bash run.sh from the command line.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.