10 ms·
On unix you'll find two programs which do this exact thing: `false` and `true`. False returns 1, and true returns 0. You might not believe that these are real
by Danieru 13y ago
On unix you'll find two programs which do this exact thing: `false` and `true`. False returns 1, and true returns 0.
You might not believe that these are real programs but they are. You can find the binaries using `whereis`. For example on my linux install true is /bin/true.
The command line is pretty awesome.
- staz 13y agoAnd here are the actual code source for them : http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/true.c;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob_p... /bin/true source is a bit longer than expected but /bin/false implementation is really interesting : http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob_plain;f=src/false.c;hb=HEAD http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob_p...
- disgruntledphd2 13y agoThat is both hilarious and brilliant. The bin/false source code made me laugh out loud.
- mtdewcmu 13y agotrue.c could be useful as a kind of helloworld -- a minimal example of the conventions followed by gnu command line programs.
- rm445 13y agoGNU Hello exists for this purpose.