Skip to Content
gnux

truex

Do nothing, successfully.

Mirrors GNU true. Run it as truex, or as gnux truex.

Synopsis

truex [ignored command line arguments]

GNU reference

Description

truex exits with status 0 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 success.

Permissions

Needs no permissions; it touches nothing.

Use cases

  • Writing an infinite loop: while truex; do ...; done.
  • Forcing a command list to succeed, as in might-fail || truex.
  • Standing in for a command that should be a no-op, such as a disabled hook.
  • Keeping a 'gnux shell -e' script going past a step whose failure is acceptable.
  • Testing how a script or CI step reacts to a command that always succeeds.
  • Giving the always-true branch of a conditional a portable command to run.

Flags

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

Examples

Exit successfully

truex

Show the exit status

truex; echox $?

Ignore every argument and still succeed

truex --any thing at all; echox $?

Ignore the failure of a command

rmx missing.txt || truex

Chain a command that always runs

truex && echox 'always runs'

Keep a gnux shell script with -e running past an allowed failure

gnux shell -e -c 'rmx old.log || truex; echox survived'

Loop until interrupted

while truex; do date; sleepx 1; done

Exit status

StatusMeaning
0always, whatever the arguments

Help in the terminal

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

See also

On this page