Shell scripts - Weird errors


danielo515

Member
Joined
Dec 26, 2012
Messages
207
Hi to everyone.

I'm trying to code some simple scripts to make my day to day easily, but I'm getting some problems.

Mainli, a sinlge problem: at the very first line #!/bin/sh I get an no such file or directory.

And I get that same error for every single comand, for example, with fuser

I think it sounds like a stupid little thing, but I can't figure what is going wrong
 
Try #!/bin/bash instead.
I think that was the first I tried, and get weird characters error. May you're right and I have a mixture of errors.

Just tried: for /bin/bash same error: so such file or directory.

Make sure you're using unix line endings.
I'm coding it in notepad++, under windows, but I choose UTF8 encoding. May I have to do something more specific?
 
Last edited by a moderator:
Encoding is not Line Break!


Per default Notepad++ creates Windows line breaks on a new document. You need to switch that to Unix Line Breaks.
 
Encoding is not Line Break!


Per default Notepad++ creates Windows line breaks on a new document. You need to switch that to Unix Line Breaks.
That was the problem!!!

Thank you!

I always have problems with line  feeds , no matter what OS or language I use  :D

Even with unix LF I had to erase and rewrite the first #!/bin/bash line directly on pandora because two weird characters, that I can't see in windows.

Now, here comes other, may-related problem:

I made a shortcut in the bottom bar for SD-Storage script. If I launch it from that shortcut I always get "SD card is in use" error. Then I tried to launch it from the menu and it works well.

Why? What's the difference?

FIXED! I love this little thing, I'm learning a lot (and I'm making lots of stupid mistakes because my HyPE but that is other topic).

Just add sudo before the script call in the shortcut.  :p
 
Last edited by a moderator:
Even with unix LF I had to erase and rewrite the first #!/bin/bash line directly on pandora because two weird characters, that I can't see in windows.
As you are using notepad++ try View -> Show Symbol -> Show All Characters.

That shows you line breaks, escape characters, tabs, etc.
 
Last edited by a moderator:
^that's what I did, and I can see LF etc, but nothing about the mentioned characters.

Thanks to everybody for such a good support.
 
if you said it to use UTF-8 it might have inserted a Byte order mark to the beginning of the file. Which breaks unix shebangs and is wrong in other ways too. You should propably just use plain "ANSI" and limit yourself to 7-bit ASCII characters when writing shell scripts anyways - the pandora OS does currently not run in UTF-8 mode by default (no LANG (or LC_*) is set, that means "C" or practically ISO8859-1 is in use).
 
if you said it to use UTF-8 it might have inserted a Byte order mark to the beginning of the file. Which breaks unix shebangs and is wrong in other ways too. You should propably just use plain "ANSI" and limit yourself to 7-bit ASCII characters when writing shell scripts anyways - the pandora OS does currently not run in UTF-8 mode by default (no LANG (or LC_*) is set, that means "C" or practically ISO8859-1 is in use).
Wow, THANKS to yo too! I though UTF-8 was the most standard one.

Pandora is teaching me a lot.

I'll use ANSI for every script I do, even in windows.

Cheers.
 
I think the pandora os is a bit "old style" running with ISO8859-1 instead of UTF-8. Most other current linux systems are UTF-8, but remember that our OS is essentially mostly from ~2008, and it is a mobile OS... It does do UTF-8 if you ask it to, but that is propably a bit untested.

Regardless, the byte order mark just should not be used...
 
Back
Top