home *** CD-ROM | disk | FTP | other *** search
/ Internet Core Protocols / Oreilly-InternetCoreProtocols.iso / Software / SURVEYOR / DATA1.CAB / Program_Executable_Files / scripts / NIS2NAME.SH
Encoding:
Linux/UNIX/POSIX Shell Script  |  1999-07-30  |  927 b   |  38 lines

  1. #!/bin/sh
  2. ########################################################################
  3. #                                        #
  4. #          Copyright (c) 1996 by Shomiti Systems, Inc.           #
  5. #                 ALL RIGHTS RESERVED                    #
  6. #                                       #
  7. #    This program is proprietary and confidential information       #
  8. #    of Shomiti Systems, Inc. and may be used and disclosed only    #
  9. #    as authorized in a license agreement  controlling such use     #
  10. #    and disclosure.                               #
  11. #                                       #
  12. ########################################################################
  13.  
  14.  
  15. if [ $# = 0 ]
  16. then
  17.     echo "Usage: $0 <output file name>"
  18.     echo "   Ex: $0 ipname.nam"
  19.     exit 1
  20. fi
  21.  
  22. ypcat hosts > $$.txt
  23.  
  24. if [ $? = 0 ]
  25. then    
  26.     awk '{ if (NR == 1) {print "[IP]";} {print $2 "=" $1;} }' $$.txt > $1
  27. else
  28.         echo "Error! ypcat commnd is not working properly."
  29.       exit 1
  30.  
  31. fi
  32.  
  33. if [ -f $$.txt  ]
  34. then
  35.      \rm $$.txt
  36. fi
  37.  
  38.