Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

True built-in

The true built-in does nothing, successfully.

Synopsis

true

Description

The true built-in does nothing, successfully. It is useful as a placeholder when a command is required but no action is needed.

Options

None.

Operands

None.

Errors

None.

In the future, the built-in may detect unexpected options or operands.

Exit Status

Zero.

Examples

See And-or lists for examples of using true in and-or lists. The examples of the getopts built-in also use true to indicate that an option is specified.

Compatibility

The true utility is specified by POSIX.1-2024.

Most implementations ignore any arguments, but some implementations respond to them. For example, the GNU coreutils implementation accepts the --help and --version options. For maximum portability, avoid passing arguments to true. To pass and ignore arguments, use the : (colon) built-in instead.