# bash/script-layout

> Checks each Bash script for a shebang, strict mode, a final `main` call when it defines functions, declarative libraries, and removed temporary files.

Checks each Bash script for a shebang, strict mode, a final `main` call when it defines functions, declarative libraries, and removed temporary files.

Part of the [`bash`](/reference/configurations/bash/) configuration, at the `all` [level](/start/concepts/#levels). It runs at the `commit` [stage](/start/concepts/#stage), per file. gspot runs this check itself.

## Why

A script that skips strict mode or hides its runtime fails silently on the machine that matters.

## What to do

Open with the shebang and run `set -euo pipefail` first. When an executable defines functions, end it with a call to main.

## Example

An executable Bash script without `set -euo pipefail` reports a finding. Put that line before the first command, and when the script defines functions, call `main` last.

## Turn it off

Turn it off for some files, with a reason:

```shell
gspot ignore bash/script-layout --paths "<glob>" --reason "<why>"
```
