#! /bin/ksh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/samples/hbaapi/prtserialnum.sh 1.2 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2003,2007 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
# @(#)58  1.2  src/bos/usr/samples/hbaapi/prtserialnum.sh, hbaapisamp, bos720 4/20/07 01:00:08
# ************************************************************************ 
# *  Program: prtserialnum                                               *
# *  Purpose: Print the machine serial number                            * 
# ************************************************************************ 
GREP=/usr/bin/grep
LSCFG=/usr/sbin/lscfg

serial=`$LSCFG -vpl sysplanar0 |$GREP -p "System:" |$GREP "Machine/Cabinet"`
if [[ $? -eq 0 ]]; then
    serial=${serial##*.}
else
    serial=`$LSCFG -vpl sysplanar0 |$GREP -p "System VPD:" |$GREP "Machine/Cabinet"`
    if [[ $? -eq 0 ]]; then
	serial=${serial##*.}
    else
	serial="N/A"
    fi
fi
echo $serial
