# SccsId[] = "%W% (USL function) %G%"
              IN_name="ISNUM"
              if [ ".${SECONDS}" = "." ]; then # Bourne function already loaded?
                 [ ."`set|egrep '^$IN_name\(\)\{$'`" != . ] && IN_loaded=1
              else # Korn or Bash shell and function already loaded?
                 if [ `expr "\`uname -s\`" : "[Ll][Ii][Nn][Uu][Xx]"` -eq 0 ]; then
                    [ ."`typeset +f|awk '/^'$IN_name'[=\(]?/'`" != . ] && IN_loaded=1
                 else # Linux
                    [ ."`typeset -F|awk '/^'$IN_name'[=\(]?/'`" != . ] && IN_loaded=1
                 fi
              fi
              if [ 0${IN_loaded} -eq 0 ]; then
              #----------------------------------------------------------------------#
              ISNUM() # Function documentation located at bottom.                    #
              #----------------------------------------------------------------------#
              { [ ."${AWK}" = . ] && { { [ -x /usr/bin/nawk ] && AWK=/usr/bin/nawk; } \
                                  ||   { [ -x /bin/gawk     ] && AWK=/bin/gawk    ; } \
                                  ||   { [ -x /usr/bin/awk  ] && AWK=/usr/bin/awk ; }; }

                if [ $# -eq 1 ]; then
                   $AWK 'BEGIN {exit (ARGV[1]~/^[\-+]*[0-9]+\.*[0-9]*$/)?1:0}' $1
                   return $?
                fi

                #------------------------------------------------------------#
                # Reaching here means something is amiss.                    #
                #------------------------------------------------------------#
                if [ .${SHLIB} = . ]; then SHLIB=/usr/local/scripts; export SHLIB; fi

                . $SHLIB/email_msg.sh # Calls $SHLIB/exit.sh

                IN_ID="$script_name($IN_name)"

                #------------------------------------------------------------#
                # If the following variables are not set, use these defaults.#
                #------------------------------------------------------------#
                : ${script_name:=`basename $0`}
                : ${sp:="                    "}

                EMAIL_MSG "ERROR (Function) $IN_ID"                   \
                  "${sp}Insufficient args.\n"                         \
                  "${sp}Usage: $IN_name num"                          \
                  "${sp}       Where 'num' is a string we're to test" \
                  "${sp}          for numeric truth (signed or)"      \
                  "${sp}          unsigned, integer or float).\n"
                return 2
              } # "IN_" prefix identifies this function's local variables.
              fi

              #======================================================================#
              #                       D O C U M E N T A T I O N                      #
              #======================================================================#
              #                                                                      #
              #      Author: Bob Orlando                                             #
              #                                                                      #
              #        Date: January 20, 1997                                        #
              #                                                                      #
              #  Program ID: isnum.sh                                                #
              #                                                                      #
              #       Usage: ISNUM number                                            #
              #                                                                      #
              #     Purpose: Determine if the value passed is numeric or no.         #
              #                                                                      #
              #     Globals: No global variables are assigned in this function.      #
              #              "IN_" prefix identifies local function variables.       #
              #                                                                      #
              # Exit_status: Function error (e.g. user supplies invalid arguments)   #
              #              return 2.  Otherwise returns true or false (1 or 0).    #
              #                                                                      #
              #       Calls: EMAIL_MSG library function.                             #
              #                                                                      #
              #       Notes: Valid range is not limited to +2147483647 - -2147483647 #
              #              because this routine only validates that the value      #
              #              passed to us is made up of numerals and appropriate     #
              #              characters (+, -, 0-9, and a decimal point.  To test    #
              #              for float values within the range above, try something  #
              #              like the following (my apologies in advance for         #
              #              squeezing the example into the space provided--it does, #
              #              however, still work):                                   #
              #                                                                      #
              #                $AWK 'BEGIN {                                         #
              #                  exit ((sprintf("%g",ARGV[1])+0)==ARGV[1])?1:0}' $1  #
              #                                                                      #
              #    Modified: 2004-04-02 Bob Orlando                                  #
              #                 v1.8  * Expand $AWK testing and assignment.          #
              #                                                                      #
              #              2004-03-03 Bob Orlando                                  #
              #                 v1.7  * Change set|egrep|awk to just set|egrep.      #
              #                                                                      #
              #----------------------------------------------------------------------#
            
Artificial Intelligence is no match for natural stupidity.
©Copyright Bob Orlando, 1997-2011
All rights reserved.
http://www.OrlandoKuntao.com
E-mail: Bob@OrlandoKuntao.com
Last update: Jan. 26, 2011
by Bob Orlando