3 ms·
/bin/true used to be an empty file
- hyper_reality 9y agoAll due respect to Rob Pike, but I think David Batley nails it in his response: > tl;dr: they replaced a cryptic, undocumented implementation, which starts an entire bash shell just so it can exit, and replaced it by a fast ELF binary, which works like all the others. /bin/true as an empty file may seem like an elegant implementation and lesson in UNIX, but it's actually slower, and I'd much rather have standardisation and documentation across all system commands.
- kmm 9y agoFunny story, AT&T claims copyright on this empty file. Every time you use a blank line in your program, you're violating their copyright http://trillian.mit.edu/~jc/humor/ATT_Copyright_true.html http://trillian.mit.edu/~jc/humor/ATT_Copyright_true.html
- dragonwriter 9y agoAT&T may claim copyright on a file that contains, besides the copyright notice, only blank lines, but even if that copyright is valid, that doesn't make any use of blank lines a violation of that copyright. Copyright violation requires actual copying/derivation, not mere similarity of content. (The latter can be evidence of the former, and often—because of the nature of the content and improbability of coincidental similarity, can be compelling evidence—but is not the thing prohibited.)
- dllthomas 9y agoAnd to make it slightly more explicit, the nature of empty content - unlike complicated creative content - is that coincidental similarity is actually pretty likely.
- ktpsns 9y agoBy the way, don't forget that virtually all (modern) shells will have a built in for /bin/true: $ type true true is a shell builtin So in your shell scripts, don't bother about performance.