#!/bin/sh ######################################## # Description: This script is used to get system information on sparc systems. ######################################## ######################### # Set variables ######################### PATH=/usr/xpg4/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin ######################### # This function displays the hardware. ######################### hardware() { manufacturer=`prtdiag | grep '^System Configuration:' | cut -d : -f 2- | awk '{print $1,$2}'` product_name=`prtdiag | grep '^System Configuration:' | cut -d : -f 2- | awk '{print $4,$5}'` value=`echo $manufacturer $product_name` echo $value } ######################### # This function displays the system name. ######################### name() { value=`hostname` echo $value } ######################### # This function displays the operating system. ######################### os() { value=`cat /etc/release | sed 's/^[ \t]*//' | grep '^Solaris' | awk '{print $1,$2}'` echo $value } ######################### # This function displays the operating system (full details). ######################### osfull() { os_version=`cat /etc/release | sed 's/^[ \t]*//' | grep '^Solaris' | awk '{print $1,$2,$3}'` os_arch=`uname -p` arch=`isainfo -b` value=`echo $os_version' ('$arch'-bit '$os_arch')'` echo $value } ######################### # This function displays the operating system (short). ######################### osshort() { value=`cat /etc/release | sed 's/^[ \t]*//' | grep '^Solaris' | awk '{print $1}'` echo $value } ######################### # This is the main part of the script. ######################### uid=`id -u` if [ $uid -ne 0 ] then echo You must be the root user to run this script. exit 0 else if [ $# -ne 1 ] then echo usage: $0 [option] echo echo " hardware Displays hardware" echo " name Displays system name" echo " os Displays operating system" echo " osfull Displays operating system (full details)" echo " osshort Displays operating system (short)" exit 0 else case $1 in hardware) hardware ;; name) name ;; os) os ;; osfull) osfull ;; osshort) osshort ;; *) echo Unknown option ;; esac fi fi exit 0