#!
shebang or shebang line is used to tell the operating system which interpreter to use to parse the rest of the file.
Lets create your first hello world
script.
1
2
3
#!/bin/bash
echo "Hello World"
Set file permission to execute.
-
+
allows execution. -
-
disallows execution. -
x
means execute permission.
1
chmod +x my_script.sh
This is how you can run it.
1
2
3
4
5
6
7
8
# option 1
./my_script.sh
# option 2
bash my_script.sh
# option 3
/bin/bash my_script.sh