> ## Documentation Index
> Fetch the complete documentation index at: https://siriusbar.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Basics

> Bash scripting fundamentals, shebangs, and conditional control flow.

Bash scripts do not need compiling. The Bash interpreter reads the script and executes its commands. Running a script normally starts a Bash process; sourcing it with `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:

```bash theme={null}
#!/bin/bash
```

This tells the OS which interpreter to use when we run the file directly, for example with `./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:

```bash theme={null}
bash script.sh
```

## if / elif / else

```bash theme={null}
if [ "$value" -ge 10 ]
then
  do_something
fi
```

The `fi` closes the if block. We chain branches with `elif` and `else`:

```bash theme={null}
if [[ $condition == "ready" ]]
then
  do_something
elif [[ $condition == "waiting" ]]
then
  do_something_else
else
  fallback
fi
```

One thing to note right away — the spaces separating `[`, 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.
