Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Returning 0 is technically doing something. It might not be something that you find useful but it is something.


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.


And here are the actual code source for them :

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_p...


That is both hilarious and brilliant. The bin/false source code made me laugh out loud.


true.c could be useful as a kind of helloworld -- a minimal example of the conventions followed by gnu command line programs.


GNU Hello exists for this purpose.


> Returning 0 is technically doing something.

Yeah, but try telling your boss that :)


Yep, boss will turn right around and "do" paying your salary




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: