Syntax

Bash Stop on Errors Syntax

In Bash, stop on errors: exits the script when any command fails — set -e

Quick Answer

Syntax
set -e
BashSyntax

Stop on Errors

Code example
set -e

Exits the script when any command fails.

Learn More

How to stop on errors in Bash

  1. Open your Bash file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Bash Stop on Errors Syntax

Use set -e.

Related Syntax References

Frequently asked questions

What is the Bash syntax for stop on errors?

Use this pattern: set -e

Can I copy this Bash code example?

Yes. Use Copy code and adapt the example to your program.

Is this Bash syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify