Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is /bin/true?

Tags:

linux

command

On a Linux system, what is /bin/true? What is it used for?

like image 798
Hulk Avatar asked Feb 01 '10 08:02

Hulk


People also ask

What is bin true in Linux?

/bin/true is a command that returns 0 (a truth value in the shell). Its purpose is to use in places in a shell script where you would normally use a literal such as "true" in a programming language, but where the shell will only take a command to run.

What is bin true and bin false?

If we look at the two commands' man pages, the descriptions are pretty simple: /bin/true – “do nothing, successfully” /bin/false – “do nothing, unsuccessfully”

What does true command do?

On Unix-like operating systems, the true command's sole purpose is to return a successful exit status. It is useful when you want part of a command or conditional expression always to be true.

What is bin bash for?

/bin/bash is the most common shell used as default shell for user login of the linux system. The shell's name is an acronym for Bourne-again shell. Bash can execute the vast majority of scripts and thus is widely used because it has more features, is well developed and better syntax.


1 Answers

/bin/true is a command that returns 0 (a truth value in the shell).

Its purpose is to use in places in a shell script where you would normally use a literal such as "true" in a programming language, but where the shell will only take a command to run.

/bin/false is the opposite that returns non-zero (a false value in the shell).

like image 86
camh Avatar answered Sep 20 '22 17:09

camh