home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 18.ddi / reloc.2 / $INTFBIN / validname < prev    next >
Encoding:
Text File  |  1990-12-08  |  867 b   |  31 lines

  1. #ident    "@(#)/usr/sadm/sysadm/bin/validname.sl 1.1 4.0 12/08/90 28995 AT&T-USL"
  2.  
  3. ################################################################################
  4. #    Module Name: validname.sh
  5. #    
  6. #    Inputs:
  7. #        $1 - system name
  8. #    
  9. #    Description: Verify a valid system name was entered.
  10. #
  11. #                    Note that the input is concatenated to "hh" and then
  12. #                    the expression is evaluated with expr. Certain characters
  13. #                    such as - and * have special meaning if they occur as lone
  14. #                    strings to expr.
  15. #                   
  16. ###############################################################################
  17. NEWARG="hh"$1
  18. # does $1 begin with -?
  19. if [ `expr $NEWARG : 'hh-'` -eq 3 ]
  20. then
  21.     exit 1
  22. fi
  23. echo $NEWARG
  24. if [ `expr $NEWARG : '[0-9A-Za-z-]*'` -eq `expr $NEWARG : '.*'` ]
  25. then
  26.         exit 0
  27. else
  28.         exit 1
  29. fi
  30.  
  31.