TrumanWong

true

The return status is success.

Summary

true

The main purpose

  • Used to perform logical operations with other commands.

return value

The return status is always successful; the return value is 0.

example

# When your script is set -e, any command that returns a failure will cause the script to exit.
set -e
# How to temporarily skip it? The following statement uses the logical OR operator to connect true, and the return value must be true.
some_command || true

# Of course, like Python's pass, it can also be used as a temporary placeholder for conditional statements.

Notice

  1. This command is a built-in bash command. For related help information, please see the help command.