In a former question, I was suggested to execute:
sudo bash start-dfs.sh
why not
sudo start-dfs.sh
? I mean, what difference does bash
makes?
In a former question, I was suggested to execute:
sudo bash start-dfs.sh
why not
sudo start-dfs.sh
? I mean, what difference does bash
makes?
A script in any (interpreted) language, like bash
or python
, needs to be "interpreted" by the interpreter of the corresponding language.
On Linux, this can be done in different ways:
The interpreter is "asked" to run the script by including the language in the command to run the script:
<language> <script>
or in your example:
sudo bash start-dfs.sh
The script is executable, and has the permission to "ask" the interpreter itself to run the code inside the script. from your example:
sudo start-dfs.sh
In this case, the script must start with the shebang, else there is no information what interpreter to call, like:
#!/bin/bash
or:
#!/usr/bin/env python
.sh
, .py
etc) makes clear what type of script it is, but plays no role whatsoever in the execution of a script, unlike in windows.
start-dfs.sh
is executable and starts with a shebang. – Jacob Vlijm Jan 28 '16 at 18:54./
? – gsamaras Jan 28 '16 at 19:04