coreutils: true invocation
1
1 16.2 ‘true’: Do nothing, successfully
1 =====================================
1
1 ‘true’ does nothing except return an exit status of 0, meaning
1 “success”. It can be used as a place holder in shell scripts where a
1 successful command is needed, although the shell built-in command ‘:’
1 (colon) may do the same thing faster. In most modern shells, ‘true’ is
1 a built-in command, so when you use ‘true’ in a script, you’re probably
1 using the built-in command, not the one documented here.
1
1 ‘true’ honors the ‘--help’ and ‘--version’ options.
1
1 Note, however, that it is possible to cause ‘true’ to exit with
1 nonzero status: with the ‘--help’ or ‘--version’ option, and with
1 standard output already closed or redirected to a file that evokes an
1 I/O error. For example, using a Bourne-compatible shell:
1
1 $ ./true --version >&-
1 ./true: write error: Bad file number
1 $ ./true --version > /dev/full
1 ./true: write error: No space left on device
1
1 This version of ‘true’ is implemented as a C program, and is thus
1 more secure and faster than a shell script implementation, and may
1 safely be used as a dummy shell for the purpose of disabling accounts.
1