Bash Scripting problem [closed]
Solution 1:
Three things:
-
Why the sudo? At this point, you do not want to run your script as root.
-
All your scripts need to start with the interpreter on the first line It's the comment sign followed by an exclamation sign. (The "Shebang") For bash, your script would look like this:
#!/bin/bash
echo "hi"
-
You should make your scripts executable with
chmod 700 myscript.sh
. Only then can you execute them like this./myscript.sh
On a related note, this is not specifically a Ubuntu question, but a generic scripting question.