Article View: comp.os.linux.admin
Article #31Re: How would a script recognize Linux?
From: Peter Funk
Date: Mon, 27 Feb 1995 23:14
Date: Mon, 27 Feb 1995 23:14
31 lines
1807 bytes
1807 bytes
In <D4KrMG.LFA@erie.ge.com> teffta@erie.ge.com (Andrew R. Tefft) writes:
> >| If I was to write a script that would run on different unixes
> >| how would I recognize Linux?
> >| Is uname good enough?
[...]
> Output of uname should be checked first. If the command exists then it
> will be sufficient to identify the system, whatever it is. If it doesn't
> exist then you should look for other stuff.
One precaution must be taken: SCO Unix has a broken uname program:
'uname -s' returns the node name rather than "SCO" or "Unix", so in
order to adjust a script to recognize such a weird platform also,
it should contain something like this :
OS=`uname -s`
case $OS in
HP-Ux) ..... ;;
IRIX) ..... ;;
Linux) ..... ;;
SunOS) ..... ;;
XENIX) .... ;;
*) if [ "$OS" = `uname -n` ]
then OS=SCOUNIX
else OS=VanillaUnix
fi ;;
esac
Regards, Peter
-=-=-
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany
office: +49 421 2041921 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)
Technical Details
Message-ID:
<5718@artcom0.north.de>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!uniol!artcom0!pfReferences:
<3il1e2$6fq@usenetw1.news.prodigy.com> <D4KrMG.LFA@erie.ge.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 100df9,650d05e30da3de92 X-Google-Attributes: gid100df9,public X-Google-Thread: 1122ea,27188ece54367802,start X-Google-Attributes: gid1122ea,public X-Google-ArrivalTime: 1995-02-27 15:14:38 PST Path: arc1-ca.pugleaf.net!nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!uniol!artcom0!pf From: pf@artcom0.north.de (Peter Funk) Newsgroups: comp.os.linux.admin,biz.sco.general Subject: Re: How would a script recognize Linux? Message-ID: <5718@artcom0.north.de> Date: 27 Feb 95 23:14:38 GMT Article-I.D.: artcom0.5718 References: <3il1e2$6fq@usenetw1.news.prodigy.com> <D4KrMG.LFA@erie.ge.com> Organization: home workstation, but owned by ArtCom GmbH, Bremen, FRG Lines: 31