[comp.unix.ultrix] How can a shell script distinguish Ultrix 2.X from 3.0?

kendall@wjh12.UUCP (Samuel C Kendall) (03/22/89)

Reply-to: kendall@wjh12.UUCP (Samuel C Kendall)


My application has different binaries in Ultrix 2.X vs. in 3.0.  To
keep installation simple and infrequent, I'd like to have a shell
script decide whether the OS is 2.X or 3.0, and run the appropriate
binary, every time the user invokes the application.

So how can the shell script distinguish?  The test must be fast and
foolproof.  (This is easy for SunOS 3.X vs. 4.0: the file
/usr/lib/ld.so, the dynamic linker, exists under and only under 4.0.)
Looking in /etc/motd is unreliable and a bit slow.  Examining the
version string in the kernel is out, because the kernel may be
unreadable.  What I'd like is the pathname of a file that exists only
under one or the other, reliably.  Remember that people may retrofit
some 3.0 facilities to a 2.X system.

Supposing I decide to distinguish in a C program instead.  How can I do
that?  (Once again, easy under Sun: getdtablesize() returns 32 vs. 64.)

Right now I look at the version number of /usr/include/ctype.h.  This
does not feel secure.

-----
Sam Kendall			kendall%saber@harvard.harvard.edu
Saber Software, Inc.		harvard!saber!kendall