# In Chrome OS, Bash will not execute my manuscript. Just how do I get Bash to run my manuscript?

I have a foo.sh documents in my existing directory site. If I attempt to run ./foo.sh, I get:

-bash: ./foo.sh: /bin/sh: bad interpreter: Permission denied


But if I run /bin/sh ./foo.sh after that it runs penalty.

Just how can I repair this so I can simply run ./foo.sh and also it instantly runs it with/ bin/sh?

Edit: Okay, this is Chrome OS and also this certain folder is placed with noexec. Evidently that hinders the capacity to simply run ./foo.sh ; yet why? Why can I still run sh foo.sh to attain the specific very same point? What protection, after that, does noexec offer?

0
2019-05-18 22:08:24
Source Share

You can additionally get this mistake (or a really, really comparable message) if you attempt to execute a documents with MS - DOS 2 - byte (carriage - return linefeed) line ends.

Strength is so clever nowadays, that it does not neccessarily show you the carriage returns as '^ M'. So you can get misleaded if you do not examine what Vim assumes the "documents layout" is and also simply rely upon the on - screen - look.

In this instance the "#!/ bin/sh ^ M" creates the bit to search for "/ bin/sh ^ M", which it can not. Negative interpreter, without a doubt.

0
2019-05-21 08:29:10
Source

The noexec flag will suitably relate to manuscripts, since that would certainly be the "anticipated" actions.

Nonetheless, establishing noexec just quits individuals that do not recognize adequate concerning what they are doing. When you run sh foo.sh you are in fact running sh from its default area (possibly /bin) which is out a filesystem placed with noexec.

You can also navigate noexec for normal binary documents by conjuring up ld straight.

cp /bin/bash $HOME /lib/ld-2.7.so$HOME/bash


This will certainly run bash, no matter whether it gets on a filesystem placed with noexec.

0
2019-05-21 05:47:14
Source