True (Unix)

True (Unix)

In Unix-like operating systems, true is a command whose only function is to always return the value 0, which is regarded by the shell as the logical value "true". It is usually employed in conditional statements and loops of shell scripts where Boolean conditions are given as the return value of a program. For example, the following Bourne shell script echos the string hello until interrupted:

while truedo echo hellodone

This program takes no "actual" parameters; in some versions, the standard parameter --help displays a usage summary and --version displays the program version.

true may also be written as a single colon (:). In that form, it is generally built into the shell, and may therefore be more efficient.

In its alias of :, true is often used (in POSIX-compatible shells such as the Bourne shell) as a dummy command when assigning default values to shell variables through the ${parameter:=word} parameter expansion form. [ [http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02 Shell Command Language: 2.6.2 Parameter Expansion] – The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition] For example, from bashbug, the bug-reporting script for bash: : ${TMPDIR:=/tmp} : ${EDITOR=$DEFEDITOR} : ${USER=${LOGNAME-`whoami`

References

ee also

*false (Unix)
*List of Unix programs

External links

*


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • true (Unix) — true ist ein Computerprogramm in Unixoiden Systemen und ein Teil des POSIX Standards[1]. Das Programm liefert den Wert 0 zurück, der von der Unix Shell als Wahrheitswert true interpretiert wird. Es wird in Shell Skripten in Kontrollstrukturen… …   Deutsch Wikipedia

  • True (UNIX) — true (в переводе с английского «истинное») консольная команда операционных систем, единственное действие которой возвратить значение 0, рассматриваемое командной оболочкой UNIX как логическое значение «истина». Команда используется там, где по… …   Википедия

  • True (Unix) — La commande true, dans les systèmes Unix, a pour unique fonction de donner la valeur 0. Elle est habituellement utilisée dans les conditions et les boucles des scripts shell. v · d · …   Wikipédia en Français

  • True — is the adjectival form of the word truth. True may also refer to:In business: *True Corporation, a Thai communications group whose subsidiaries include True Internet, True Move and True Visions In music: *True (Spandau Ballet album) *True… …   Wikipedia

  • True — (englisch für wahr, zutreffend) bezeichnet eine Aussage, siehe Aussagenlogik true (Unix), ein Kommandozeilenprogramm unter Unix True (Kurzfilm), einen Kurzfilm aus dem Jahr 2004 des Regisseurs Tom Tykwer Frederick William True (1858–1914), ein… …   Deutsch Wikipedia

  • true — (в переводе с английского «истинное»)  консольная команда UNIX совместимых операционных систем, единственное действие которой  возвратить значение 0, рассматриваемое командной оболочкой UNIX как логическое значение «истина». Команда… …   Википедия

  • Unix — (marque déposée officiellement comme UNIX, parfois aussi écrit comme Unix avec les petites capitalisations) est le nom d un système d exploitation multitâche et multi utilisateur créé en 1969, conceptuellement ouvert et fondé sur une approche par …   Wikipédia en Français

  • Unix time — Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1 1970, not counting leap seconds. It is widely used not only on Unix like… …   Wikipedia

  • UNIX — UNIX, parfois écrit « Unix », avec des petites capitales, est un système d exploitation multitâche et multi utilisateur créé en 1969, conceptuellement ouvert et fondé sur une approche par laquelle il offre de nombreux petits outils… …   Wikipédia en Français

  • True — (в переводе с английского «истинное») консольная команда UNIX совместимых операционных систем, единственное действие которой возвратить значение 0, рассматриваемое командной оболочкой UNIX как логическое значение «истина». Команда используется… …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”