nonsense words for files

Guy Harris guy at sun.uucp
Sat May 18 18:43:12 AEST 1985


> > On what UNIX systems (or what shells) is test part of the shell?  On
> > every system (and shell) I've used, it's in /bin/test.

> 	/bin/test will probably always be there but in the SysV R2 Bourne
> 	shell 'test' is a builtin.

It's a builtin in System III and System V (release 1 and 2).  It probably
was a builtin in UNIX/TS 1.0 and PWB/UNIX 2.0 (the predecessors to System
III).  System V doesn't have "/bin/test" because it doesn't need it.  There
is also a stub of code in the V7 shell (which is the 4.xBSD shell as well)
to have "test" be a builtin under the name "[".  In the TS 1.0/PWB 2.0/S3/S5
shell, it's builtin under the name "[" as well as "test".  Furthermore, if
you do

	ln /bin/test /bin/[

under V7, you can call it "[" as well; 4.xBSD comes with this already done.
That way, you can write

	if [ -f /etc/foo ]

instead of

	if test -f /etc/foo

which, arguably, looks cleaner.

Building it into the shell makes scripts which do lots of "test"s run much
faster.

	Guy Harris



More information about the Comp.unix mailing list