#!/bin/sh version="release 7." release=$(cat /etc/redhat-release) echo $release result=$(echo $release | grep "${version}") if [[ "$result" != "" ]] then echo "当前linux版本是7" else echo "当前linux版本是6" fi
#!/bin/sh version="release 7." release=$(cat /etc/redhat-release) echo $release result=$(echo $release | grep "${version}") if [[ "$result" != "" ]] then echo "当前linux版本是7" else echo "当前linux版本是6" fi