Skip to Content
gnux

falsex

Do nothing, unsuccessfully.

Mirrors GNU false. Run it as falsex, or as gnux falsex.

Synopsis

falsex [ignored command line arguments]

GNU reference

Description

falsex exits with status 1 and does nothing else: it reads no input, writes no output and ignores every argument it is given. The only exceptions are --help and --version, which are honored when they are the sole argument. It exists so scripts have a portable command whose result is always failure.

Permissions

Needs no permissions; it touches nothing.

Use cases

  • Testing how a script or CI step reacts to a failing command.
  • Disabling a hook or account shell by pointing it at a command that always fails.
  • Terminating an until loop condition: until falsex; do ...; done never stops on its own.
  • Checking that 'gnux shell -e' aborts a script at the first failure.
  • Exercising the else branch of a conditional or the right side of ||.
  • Standing in for a command that is expected to fail in examples and tests.

Flags

      --help      display this help and exit
      --version   output version information and exit

Examples

Exit with status 1

falsex

Show the exit status

falsex; echox $?

Run a fallback when a command fails

falsex || echox 'fallback ran'

Skip the command after &&

falsex && echox never; echox "status: $?"

Take the else branch of a conditional

if falsex; then echox yes; else echox no; fi

See gnux shell -e stop at the first failure

gnux shell -e -c 'echox before; falsex; echox after'; echox "shell exited $?"

Pass the status through envx, which exits with the command's status

envx falsex; echox $?

Exit status

StatusMeaning
1always, whatever the arguments

Help in the terminal

falsex --help                # options, first examples, exit status
gnux help falsex             # this page: the full manual
gnux help falsex --OPTION    # one option in depth, with its examples

See also

On this page