From: bsh on
David Kirkby <drkir...(a)gmail.com> wrote:
> I have this in a script, where $UNAME will be the output of 'uname',
> except on Cygwin, where it will be "CYGWIN".

P.S. I hope you are not writing your own host detection script.
The best one is config.guess from the autoconf distribution:

config.guess.sh; config.sub.sh: "determine 'canonical host triple'"
http://www.bothner.com/~bothner/software/config.guess

.... But plenty others exist, including:

archguess.sh: "determine OS/distribution/version: NCA?"
http://sf.net/projects/archguess/

archit.sh: "guess machine's application architecture"
http://www.cs.indiana.edu/~kinzler/home/binp/archit

opsys.sh
http://www.cs.indiana.edu/~kinzler/home/binp/opsys

platform.sh: "platform identification utility"
<shtools-distribution>/platform.sh

whatami.sh: "determine type of host: contained-in Msys distribution"
http://www-unix.mcs.anl.gov/systems/software/msys/

> What of the following two lines is more portable?
> if [ "x$UNAME" != xSunOS ] && [ "x$UNAME" != xCYGWIN ] && [ "x$UNAME" !
> = xHP-UX ]; then
> or
> if [ "$UNAME" = SunOS -a "$UNAME" = CYGWIN -a "$UNAME" = HP-UX ]; then
> I believe the former is more portable, but someone has suggested the
> use of the latter.

Hello Dave,

I'm a bit confused as this is a question already asked and answered:

http://groups.google.com/group/comp.unix.shell/msg/257da9fb6fdaa19b

=Brian