Bash Script Permission denied & Bad Interpreter
You have a space instead of a forward slash here:
#! /bin bash
Should be:
#! /bin/bash
or simply
#!/bin/bash
(the first space is optional).
The shebang (#!
) should be followed by the path to an executable, which may be followed by one argument, e.g.,
#!/usr/bin/env sh
In this case /usr/bin/env
is the executable; see man env
for details.
Just /bin
refers to a directory.
It is worth noting that if the mountpoint on which your script resides has the 'noexec' attribute, then you can shebang all you want and it still won't work, but invoking the interpreter with the script as an argument will (so long as that in turn doesn't try to run another script on a noexec mount).