Update nmsagent.sh

加强 OS_TYPE 读取方式
This commit is contained in:
方顺健
2018-10-09 11:23:16 +08:00
parent 56d71f261a
commit f4ae72e55c

View File

@@ -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" : '.*-> \(.*\)$'`