Solved [Solved] Cannot run script

Hi guys,

I have written a script and made it executable but when I tried to run it I get the following:
Code:
./myscript.sh: not found
But if I do an ls , the file is there. I event tried to change the file to 777.

Could anyone help please?

I'm on FreeBSD 9.2 and my script starts with
Code:
#!/bin/sh
 
Re: Cannot run script

The error for the script not being executable is "permission denied".

I believe "not found" refers to a missing command inside the script.
 
Re: Cannot run script

Check the first line of the script, the so called "she-bang". If that points to an invalid interpreter then you'll get the message which you described.
 
Re: Cannot run script

Hi guys,

Thank you for the reply.

I just worked out after looking at the file in vi that I forgot to convert the ^M linebreak to 'normal' line break.

The problem has now been solved :)
 
Re: Cannot run script

fred974 said:
Moderators, how do I mark the post as solved?
Good question. We used to have a ready-to-go answer (edit the original post, select "go advanced" and select the prefix "[Solved]") but since the migration to the new forum software I'm not quite sure yet.
 
Re: Cannot run script

Just an idea (not sure if this will work): Edit your first message in this thread and change the topic yourself (my suggestion would be to add "(solved)" (no "") in front of it).

At this moment that would be the easiest way I think.
 
Back
Top