0

Ok, so basically i have created the script by going to bin in the terminal and typing in

sudo nano mytesterscript.sh

From there i wrote the script and saved it. To make it executable, i then used the command

    chmod +x mytesterscript.sh

then when i wanted to execute it by using

./mytesterscript.sh

I get the error:

bin/bash: bad interperter:no such file or directory

I can execute the script by typing

bash mytesterscript.sh

but i want to be able to do it like

./mytesterscript.sh

Any ideas guys?

#!bin/bash
#declare $STRING Variable
STRING= "Hello world"
#print variable on screen
echo $STRING
5
  • 1
    What is content of mytesterscript.sh? Looks like shebang is incorrect. Commented May 21, 2014 at 20:32
  • its just a script that says hello world Commented May 21, 2014 at 20:50
  • Can you please edit your question and post scripts full content? Commented May 21, 2014 at 20:51
  • 1
    @user3662438, Notice the difference between your first line, and my answer. You are missing the / in front of the bin. Commented May 21, 2014 at 20:55
  • Thanks guys for the help it works now seems pretty stupid i just missed out a / :) Commented May 21, 2014 at 21:00

2 Answers 2

4

Make sure the top of your script says:

#!/bin/bash

Observe the / in front of bin.

If that does not work, try which bash and use that output.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks guys for the help it works now seems pretty stupid i just missed out a / :)
@user3662438, It happens to the best of us, and one character is very hard to spot.
-1

have happened to me right now :D But solution is not in 1st line but in space

# replace:
STRING= "Hello world"

# by:

STRING="Hello world"

Took me approximately hour of struggling :D

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.