true a statement that logically evaluates to true. It is often used to check whether statements evaluated succesfully or not. It is the logical inverse of ‘false’, also a unix command.

$ true
$ rm -rf directory || true

Useful Options / Examples


This just logically evaluates to true. This is most useful in scripting

while true
   echo 'infinite loop'

rm -rf directory || true

This is useful because sometimes we want to make sure that a command that could end with an error will return with exit status zero, to make sure that a script will continue running.