Shell脚本判断OS版本 Shell脚本判断OS版本 uname /etc/os-release CentOS 7: Ubuntu 16.04: 在Shell脚本中这样使用: lsb_release Ubuntu 16.04 CentOS 7 centos7 安装lsb_release 安装lsb_release linux系统安装lsb_release 在线安装lsb_release 离线安装lsb_release Shell脚本判断OS版本 Shell脚本中经常需要对操作系统的版本类型类型进行判断。这里介绍几种常用的方法,如有遗漏请包涵 😃 uname uname ( short for unix name ) 用来打印系统信息,在shell脚本中可以这样使用: if [ x`uname`x = xFreeBSDx ]; then sudo pkg install -yq \ devel/git \ ... else