source or . runs it inside the current shell. We mainly use Bash for automation, filtering and cron jobs.
The Shebang
An executable Bash script usually starts with this:./script.sh. We put it on the very first line. Another common form is #!/usr/bin/env bash, which finds Bash through the current environment. Other interpreted languages use the same shebang mechanism with their own interpreter.
The shebang is not required when we explicitly pass the file to Bash:
if / elif / else
fi closes the if block. We chain branches with elif and else:
[, its arguments and ] are required. Skip them and Bash interprets the text as a different command. Those [ ] brackets are not just decoration. What they actually are, we cover in the next part.