-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystype.sh
More file actions
executable file
·49 lines (45 loc) · 1.19 KB
/
systype.sh
File metadata and controls
executable file
·49 lines (45 loc) · 1.19 KB
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
# (leading space required for Xenix /bin/sh)
#
# Determine the type of *ix operating system that we're
# running on, and echo an appropriate value.
# This script is intended to be used in Makefiles.
# (This is a kludge. Gotta be a better way.)
#
#
# 确定我们正在运行的 *ix 操作系统的类型,并回显一个适当的值.
# 该脚本旨在用于 Makefiles 中.
# (这是一种权宜之计.一定有更好的方法.)
#
# 根据不同的操作系统类型设置PLATFORM变量
case `uname -s` in
# 如果操作系统是FreeBSD
"FreeBSD")
# 将PLATFORM变量设置为freebsd
PLATFORM="freebsd"
;;
# 如果操作系统是Linux
"Linux")
# 将PLATFORM变量设置为linux
PLATFORM="linux"
;;
# 如果操作系统是Darwin(即Mac OS X)
"Darwin")
# 将PLATFORM变量设置为macos
PLATFORM="macos"
;;
# 如果操作系统是SunOS(即Solaris)
"SunOS")
# 将PLATFORM变量设置为solaris
PLATFORM="solaris"
;;
# 如果操作系统是其他类型
*)
# 打印错误信息到标准错误输出
echo "Unknown platform" >&2
# 以非零状态码1退出,表示有错误发生
exit 1
esac
# 打印操作系统类型到标准输出
echo $PLATFORM
# 以零状态码退出,表示程序正常结束
exit 0