Question: There are two ways of executing a bash script from a Linux CLI.

Either you do:

```
bash myscript.sh

```

or:

```
./myscript.sh

```

At first I thought both methods were identical. However I've noticed at my work that `sudo bash` is disabled by system administration (ie I need root permission to do that) while `sudo ./` is no problem.

What is the difference between launching a script through `bash myscript.sh` vs `./myscript.sh`? And is there a logical explanation for not allowing the user to execute a script through `sudo bash myscript.sh` while allowing him to do `./myscript.sh`?

Answer: 
```
bash myscript.sh

```

This runs `bash` (which must be in a directory that is part of your `PATH`) in a new process and instructs it (assuming that `bash` refers to the Bash shell) to load and execute `myscript.sh` (which must be in a directory that is part of your `PATH` or in that process' current working directory). Note that it is always `bash` that will be used to interpret the content of `myscript.sh` in this case.

```
./myscript.sh

```

This runs `./myscript.sh`. In the course of this, the file is checked for a [shebang](http://en.wikipedia.org/wiki/Shebang_%28Unix%29) line. The script is executed in a new process using the shell specified in that line, or using a default shell (as specified in the `SHELL` environment variable or `/etc/passwd`). Therefore the actual program interpreting `myscript.sh` may vary in this case.
Executing Bash scripts with ./script.sh is the only method when the PATH variable doesn't contain the Path to the directory. If it did, it could be executed via script.sh as well.