Sh file not found but file exists

Today, i build a new a 2.8 console image with small modifications (added some software like qt, sqlite, nano… - didn’t had any problems with on 2.7).

Now if create a bash script and want to execute it, I get the following error:

root@colibri-imx6:~# ./test_bash.sh
/bin/sh: ./test_bash.sh: not found

Yes the file exists and has execution rights:

root@colibri-imx6:~# ls -la
drwxr-xr-x    4 root     root          1024 Feb 20 23:03 .
drwxr-xr-x    4 root     root          1024 Feb 20 22:48 ..
-rw-------    1 root     root           621 Feb 20 23:04 .ash_history
drwx------    3 root     root          1024 Feb 20 23:03 .config
drwxr-xr-x    3 root     root          1024 Feb 20 20:55 .local
-rwxr-xr-x    1 root     root            25 Feb 20 23:03 test_bash.sh
root@colibri-imx6:~# cat test_bash.sh
#!/bin/sh/

echo "Hallo"

I tried it with different scripts, they fail all.

Before I could boot, I had to reset the env vars in uBoot (env default -a). (Last Image Version was from 2.7b3)

Any ideas?

Try chmod +x test_bash.sh and re-run. Happened to me a lot, even though those permissions look fine, give it a shot.

Regards

Hi

I guess this is caused by the trailing ‘/’ when specifying the interpreter to use

-#!/bin/sh/
+#!/bin/sh

Max

I think that I’ve already tried that a 1000 times…

Right at this moment, I’m not able to test this, but I’m pretty sure, that this is not the problem. As already mentioned in my initial post, other scripts also get the same error. And those scripts had no error on the BSP V2.7. The “test_bash.sh” is just a short example (yeah with a typo).

Hi
i tried your script on the Colibri-iMX6_LXDE-Image_2.8b1.64-20171229.tar.bz2 image and it is working fine.