Recently while stumbling my way through Solaris I came across a command I’m not familiar with.
/usr/bin/true is a shell script which when run will return true (execute successfully.)
Now, this code clearly goes back a bit into UNIX history and I was amused to see exactly how the developers coded it. With that in mind, and against all copyrights and rights reservations I now present the complete and unabridged code for /usr/bin/true:
bash-2.03$ more /usr/bin/true
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#ident "@(#)true.sh 1.6 93/01/11 SMI" /* SVr4.0 1.4 */
Why on earth would you copyright this? Perhaps even more impressive is the point that this is version 1.6! What did previous versions of this look like? And why such a big deal about this being unpublished source code? Hell, it’s not even source code, let alone published.
Well, if you’re curious, this script is all comments, therefore when it is run it does nothing… Of course it does nothing quite successfully, therefore returning ‘true’ for the purposes of evaluating conditions.
I do have to give the developers of this credit for simplicity. I’m sure if it weren’t for the lawyers this could have been a one line file.