Basic Shell Script Structure
Shebang
- Every shell script starts with a shebang (
#!
) followed by the path to the interpreter.
#!/bin/bash
Hello World Script
- We can save this as
hello.sh
, make it executable withchmod +x hello.sh
, and then run it with./hello.sh
.
#!/bin/bash
echo "Hello, World!"