ex-23-01_ostype.sh
来自「Berkely的学生写的」· Shell 代码 · 共 40 行
SH
40 行
#!/bin/sh# Chapter 23 - Scripting for Portability# This script provides two functions that you can use to# determine the version of the operating system your are running.## To use these functions in your scripts you will have to "source"# this script in using the . command.getOSName() { case `uname -s` in *BSD) echo bsd ;; SunOS) case `uname -r` in 5.*) echo solaris ;; *) echo sunos ;; esac ;; Linux) echo linux ;; HP-UX) echo hpux ;; AIX) echo aix ;; *) echo unknown ;; esac}isOS() { if [ $# -lt 1 ] ; then echo "ERROR: Insufficient Aruments." >&2 return 1 fi REQ=`echo $1 | tr '[A-Z]' '[a-z]'` if [ "$REQ" = "`getOSName`" ] ; then return 0 ; fi return 1 }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?