#!/bin/sh ######################################## # Description: This script is used to show Linux distribution information. # Required files: lsb_release, wc, cut, sed, cat, grep, uniq, uname ######################################## #################### # Main #################### lsb_release -v > /dev/null 2>&1 if [ $? -eq 0 ] then line_count=`lsb_release -a /dev/null 2>&1 | wc -l` if [ $line_count -gt 1 ] then release_words=`lsb_release -r | cut -d : -f 2 | wc -w` if [ $release_words -gt 1 ] then distribution=`lsb_release -r | cut -d : -f 2 | sed 's/^[ \t]*//;s/[ \t]*$//'` else distribution=`lsb_release -d | cut -d : -f 2 | sed 's/^[ \t]*//;s/[ \t]*$//'` fi else distribution=`lsb_release -a` fi else cat /etc/*release | grep -v = | grep '.' | uniq | grep ' ' > /dev/null if [ $? -eq 0 ] then distribution=`cat /etc/*release | grep -v = | grep '.' | uniq | grep ' '` else distribution=`cat /etc/*release | grep '^PRETTY_NAME=' | cut -d = -f 2 | sed 's/^["\t]*//;s/["\t]*$//'` fi fi architecture=`uname -m` echo Distribution: $distribution echo Architecture: $architecture exit 0