From f4ae72e55c69651e71fbbc8776034a883223d818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E9=A1=BA=E5=81=A5?= Date: Tue, 9 Oct 2018 11:23:16 +0800 Subject: [PATCH] =?UTF-8?q?Update=20nmsagent.sh=20=E5=8A=A0=E5=BC=BA=20OS?= =?UTF-8?q?=5FTYPE=20=E8=AF=BB=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linuxinstall/shell/nmsagent.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/linuxinstall/shell/nmsagent.sh b/linuxinstall/shell/nmsagent.sh index 9450828..385a424 100644 --- a/linuxinstall/shell/nmsagent.sh +++ b/linuxinstall/shell/nmsagent.sh @@ -21,8 +21,18 @@ # resolve links - $0 may be a softlink PRG="$0" -#OS_TYPE=$( lsb_release -d| cut -d: -f2| cut -f2 ) -#echo $OS_TYPE +if [ -f /etc/redhat-release ]; then + OS_TYPE=`cat /etc/redhat-release` +else + islsb=`which lsb_release | wc -l` + if [ "$islsb" != "0" ]; then + OS_TYPE=$( lsb_release -d| cut -d: -f2| cut -f2 ) + else + OS_TYPE=`uname -a | awk '{print $1" "$2" "$3}'` + fi +fi +echo $OS_TYPE + while [ -h "$PRG" ]; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'`