File: ostype

package info (click to toggle)
glide 2002.04.10ds1-24
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 60,076 kB
  • sloc: ansic: 290,125; asm: 23,305; sh: 8,090; pascal: 3,854; makefile: 1,258; perl: 72
file content (55 lines) | stat: -rwxr-xr-x 1,076 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#
# $Log: ostype,v $
# Revision 1.2  2000/06/15 00:11:40  joseph
# Merged new swlibs code being used for Voodoo4/5 (h5).
#
# Revision 1.1.1.1  2000/03/16 20:38:24  bwhite
# Imported CSIM sources
#
# Revision 1.5  1996/11/01 18:49:35  psmith
# added "-all" flag which echoes all the supported architecture types
#
# Revision 1.4  1996/10/30 20:04:57  psmith
# modified to conform to new /home/tools directory structure
#
# Revision 1.3  1996/09/03 18:06:19  psmith
# revised architecture names to: solaris, sunos, hpux
#
#

# if '-all' flag, return all supported architecture types

if [ $# -ge 1 ]
then
        if [ $1 = "-all" ]
        then
                echo "hpux sunos solaris linux"
                exit 0
        fi
fi

# determine and return machine architecture type

a=$(/bin/uname -s)
case $a in
  "HP-UX")
    echo "hpux"
    ;;
  "SunOS")
    b=$(/bin/uname -r | /usr/bin/cut -c1)
    if [ $b -gt 4 ]
    then
        echo "solaris"
    else
        echo "sunos"
    fi
    ;;
  "Linux")
    echo "Linux"
    ;;
  *)
    echo "unknown"
    ;;
esac