Syntax
Bash Exit a Script Syntax
In Bash, exit a script: stops the script with a status code — exit 1
Quick Answer
- Syntax
exit 1
BashSyntax
Exit a Script
Stops the script with a status code.
How to exit a script in Bash
- Open your Bash file or editor.
- Copy the example, then replace its sample names and values for your code.
Bash Exit a Script Syntax
Use exit 1.
Related Syntax References
Frequently asked questions
What is the Bash syntax for exit a script?
Use this pattern: exit 1
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