#!/bin/sh #Uname alike command for NeXTSTEP on Mach #Mike Tremaine #No getopts so options need to be seperated for now. #Much slower then a C version. #Set your the perferred version of the OS String OSNAME="NeXTSTEP" #OSNAME="NeXTStep" #OSNAME="NextStep" #OSNAME="NEXTSTEP" #OSNAME="nextstep" #Handle no arguments if [ $# -lt 1 ]; then echo "$OSNAME" exit 0; fi #Argument loop while [ $# -gt 0 ] do #Main Case Switch case "$1" in -a) #Order is -s -n -r -v -m -p -i platform=`/usr/bin/machine` machine=`/usr/bin/arch` hostname=`/bin/hostname` processor=`/usr/bin/machine` release=`/usr/bin/hostinfo | grep 'NeXT Mach.*:' | sed -e 's/^.*N/N/' -e 's/:.*//'` system="$OSNAME" version=`/usr/bin/hostinfo | grep 'NeXT Mach.*:' | sed -e 's/^.*: //'` echo "$system $hostname $release $version $machine $processor $platform" exit 0; ;; -i) platform=`/usr/bin/machine` echo -n $platform ;; -m) machine=`/usr/bin/arch` echo -n $machine ;; -n) hostname=`/bin/hostname` echo -n $hostname ;; -p) processor=`/usr/bin/machine` echo -n $processor ;; -r) release=`/usr/bin/hostinfo | grep 'NeXT Mach.*:' | sed -e 's/^.*N/N/' -e 's/:.*//'` echo -n $release ;; -s) system="$OSNAME" echo -n $system ;; -v) version=`/usr/bin/hostinfo | grep 'NeXT Mach.*:' | sed -e 's/^.*: //'` echo -n $version ;; *) echo "Usage: $0 [-a] [-i] [-m] [-n] [-p] [-r] [-s] [-v]" exit 1 esac #Add whitespace if [ $# -gt 1 ]; then echo -n " " fi #Shift argument list shift done #Line break echo exit 0 #Examples # #uname -a #Linux dwarfstar.stellarcore.net 2.6.9-42.0.10.EL #1 Tue Feb 27 09:24:42 EST 2007 i686 i686 i386 GNU/Linux #uname -a #SunOS neutron.stellarcore.net 5.10 Generic_118833-24 sun4u sparc SUNW,UltraSPARC -IIi-cEngine