false
Do nothing, unsuccessfully (exit with 1)
Overview
The `false` command does nothing except exit with a status code of 1, which indicates failure. It is used in shell scripts to provide a command that always fails or to create conditions that are initially false.
Syntax
false [ignored_arguments]Common Options
[arguments]Any arguments provided are typically ignored.
--help(GNU version) Display help and exit.
--version(GNU version) Output version information and exit.
Examples
$ false
Exits with a status code of 1.
$ if false; then echo "Will not print"; else echo "Failure!"; fi
The `else` block will execute because `false` indicates failure.
$ false || echo "This will run because false failed."
Uses the OR (||) operator; the second command runs if the first fails.
$ ! false
Negates the exit status of `false`, resulting in an overall success (exit status 0).
Related Commands
falsefailureexit 1scriptingconditionboolean