[TUHS] true command (was:History of cal(1)?)
Alan Coopersmith via TUHS
tuhs at tuhs.org
Sat Sep 27 09:01:38 AEST 2025
On 9/25/25 17:22, jason-tuhs--- via TUHS wrote:
>
>> Heck; at one time the "true" command was a Shell script with a huge copyright
>> notice, followed by... nothing... (The "false" script actually had "exit 1"
>> at the end.)
>
> From http://web.42.net/true.html
>
> ==========================================================================
> cat /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 */
>
>
>
> I'm not sure what I like most. The fact that they're claiming strict
> copyright on a file that is all comments? The fact that they're up to
> version 1.6 of all-comments, after five years of development? Or the fact
> that the GNU version had to be rewritten (due to the above copyright), and
> thus actually offers three times as much functionality?
The ident line containing SMI indicates that the revision information comes
from the Solaris source control system ("SMI" == "Sun Microsystems, Inc.").
The "SVr4.0 1.4" comment at the end points to the revision of the file from
AT&T's SVR4 source control system.
Looking in our internal archives of the SCCS trees, Solaris 2.0 (the first
SVR4 based release) had revision 1.3 of usr/src/cmd/true/true.sh,
Solaris 2.1 updated it to revision 1.5, and Solaris 2.2 through 9
shipped the above mentioned revision 1.6.
Version 1.3 added '#!/sbin/sh' and Version 1.6 changed to '#!/usr/bin/sh'
-- all the other revisions were just syncing copyright info from AT&T
or futzing with the format of the #ident lines. (The change from /sbin
to /usr/sbin is recorded as avoiding warning messages when run in a non-C
locale, since the statically linked shell in /sbin only supported the C
locale and complained if you tried to run it in any other locale.)
Solaris 10 replaced it with a C implementation to avoid shell startup
overhead (including time wasted by the shell parser reading and discarding
all the comment lines in the shell script).
Personally, I still think the OpenSolaris clear command wins in terms of
comment lines to functionality:
https://github.com/illumos/illumos-gate/blob/master/usr/src/cmd/clear/clear.sh
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - https://blogs.oracle.com/solaris
More information about the TUHS
mailing list