Decoded: true (coreutils)

[Back to Project Main Page]

Note: This page explores the design of command-line utilities. It is not a user guide.
[GNU Manual] [POSIX requirement] [Linux man] [FreeBSD man]

Logical flow of true command (coreutils)

Summary

true - Do nothing, successfully

[Source] [Code Walkthrough]

Lines of code: 81
Principal syscall: None
Support syscalls: None
Options: 2 (help and version)

Spirtually linked to the true utility from Version 7 UNIX (1979)
Added to Shellutils in August 1999 [First version]
Number of revisions: 55 [Code Evolution]

The purpose of true is to force a guaranteed evaluation of true in the shell (thus in shell scripts)

Helpers:
  • None
External non-standard helpers:
  • None

Setup

true (and false) macros EXIT_STATUS to the respective return value. Thus, true is the only possible exit to this utility

true only uses the default parsing options, which require no initialization

No additional variables are initialized in main()


Parsing

Verision and help are handled as with all utilities

Parsing cannot fail for true.


Execution

Execution returns EXIT_STATUS and cannot fail


[Back to Project Main Page]