systemname=`uname -a` echo $systemname ubuntu1804="18.04." ubuntu1604="16.04." result=$(echo $systemname | grep "${ubuntu1804}") if [[ "$result" != "" ]] then echo "ubuntu 18.04" fi result=$(echo $systemname | grep "${ubuntu1604}") if [[ "$result" != "" ]] then echo "ubuntu 16.04" fi