Previous Table of Contents Next


The function scripts arch.sh.fctn (displayed earlierin this chapter), hostname.sh.fctn, osr.sh.fctn, and whoami.sh.fctn are used to help in the transition fromSunOS 4.x to Solaris 2.x.

hostname.sh.fctn Function

The hostname.sh.fctn script emulates the SunOS 4.xhostname command:

#
#  %M%:    Version:  %I%    Date:     %G%
#
[ $_Hostname_loaded ] || {
# Function:
#     @(#)hostname                   (Wayne.Thompson@Sun.COM)02/15/92
#
# Description:
#     This function emulates 4.x hostname(1) given no arguments.
#
# Variables:
#
# Usage:
#     Hostname
#
# Return:
#
# Dependencies:
#     This funcion works under SunOs 3.x - 5.x.
#
# Bugs:
#

Hostname () {
    /bin/hostname 2>&- || /bin/uname -n
}

_Hostname_loaded=1
}

osr.sh.fctn Function

The osr.sh.fctn script outputs the numeric portion of the current operating system release--for example, 5.2 for Solaris 5.2 system software:

#
#  %M%:    Version:  %I%    Date:     %G%
#
[ $_Osr_loaded ] || {
# Function:
#     @(#)Osr                      (Wayne.Thompson@Sun.COM)02/08/92
#
# Description:
#     This function outputs the numeric portion of the current OS
      release.
#
# Variables:
#
# Usage:
#     os=`Osr`
#
# Return:
#     Ø success
#     1 non-success
#
# Dependencies:
#     This funcion works under SunOs 3.x - 5.x.
#
# Bugs:
#

Osr () {
    /bin/expr `
        {
            /bin/uname -r ||
            /bin/cat /usr/sys/conf*/RELEASE
        } 2>&- ||
        /etc/dmesg |
        /bin/awk '
            BEGIN { status = 1 }
            /^SunOS Release/ { print $3; status = Ø; exit}
            END { exit status }
        ' ||
        /bin/expr "\`
            /usr/ucb/strings -50 /vmunix |
            /bin/egrep '^SunOS Release'
        \`" : 'SunOS Release \([^ ]*\)'
    ` : '\([.Ø-9]*\)'
}
_Osr_loaded=1
}

whoami.sh.fctn Function

The whoami.sh.fctn emulates the Sun OS 4.xwhoami command:

#
#  @(#)  whoami.sh.fctn      1.2    Last mod: 6/4/93
#
[ $_Whoami_loaded ] || {
# Function:
#     @(#)whoami                   (Wayne.Thompson@Sun.COM)03/20/92
#
# Description:
#     This function emulates 4.x whoami(1).
#
# Variables:
#
# Usage:
#     whoami
#
# Return:
#
# Dependencies:
#     This funcion works under SunOs 3.x - 5.x.
#
# Bugs:
#
Whoami () {
    /usr/ucb/whoami 2>&- ||
    /bin/expr "`/bin/id`" : '[^(]*(\([^)]*\)'
}
_Whoami_loaded=1

}


Previous Table of Contents Next