home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / sgi / 16343 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  2.6 KB

  1. Path: sparky!uunet!portal!lll-winken!fnnews.fnal.gov!fnsony.fnal.gov!shah
  2. From: shah@fnsony.fnal.gov (Hemant Shah)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: FAQ How to obtain my ethernet address?
  5. Message-ID: <1du9g1INNj2o@fnnews.fnal.gov>
  6. Date: 12 Nov 92 18:58:09 GMT
  7. References: <34037@adm.brl.mil>
  8. Reply-To: shah@fnalb.fnal.gov
  9. Organization: Fermi National Accelerator Laboratory, Batavia, IL
  10. Lines: 51
  11. NNTP-Posting-Host: fnsony.fnal.gov
  12.  
  13. In article <34037@adm.brl.mil>, HACK@fcrfv2.ncifcrf.gov writes:
  14. |> I know it's been recently asked but I can't find my notes . . .
  15. |> 
  16. |> What is the command to obtain my Ethernet address?
  17. |> 
  18. |> Thanks.
  19. |> 
  20. |> Dallas C. Hack
  21. |> hack@fcrfv1.ncifcrf.gov
  22.  
  23. Here's a little shell script I use:
  24. ---------------- 8< ------- Begin shell script ---------- 8< -------------
  25. #!/bin/sh
  26.    # On SGI systems, sysinfo command gives 2 different outputs depending on
  27.    # the model. It display 4 rows of numbers. On some systems it give last 4
  28.    # bytes of the ethernet address and rest of the fields are "00", in that
  29.    # case prepend "08:00" which identifies this system as SGI.
  30.    # On other systems it displays 4 rows of numbers (not all are "00")
  31.    # in this case first alternate 6 set of numbers give full ethernet address
  32.    # of the system.
  33.    ether_addr=`sysinfo | nawk 'BEGIN{getline}
  34.                               {
  35.                                 for( i=5; i<=NF; i++)
  36.                                   if( $i != "00")
  37.                                   {
  38.                                     temp_flag = 1
  39.                                     i = NF
  40.                                   }
  41.                                 if( temp_flag > 0 )
  42.                                 {
  43.                                   printf("%s",$1)
  44.                                   for( i=3; i <= 12; i=i+2)
  45.                                     printf(":%s",$i)
  46.                                 }
  47.                                 else
  48.                                     printf("08:00:%s:%s:%s:%s",$1,$2,$3,$4)
  49.                               exit}'`
  50.  
  51. echo $ether_addr
  52.  
  53. ---------------- 8< ------- end shell script ---------- 8< -------------
  54.  
  55. -- 
  56. -------------------------------------------------------------------------------
  57. Hemant Shah                            | All the opinions expressed are my own
  58. Fermi National Accelerator Laboratory  | and does not necessarily reflect
  59. Systems Integration Group              | those of Fermilab.
  60. E-mail :shah@fnal.fnal.gov             |
  61.  Voice : (708) 840-8071                   | I haven't lost my mind
  62.    Fax : (708) 840-2783                | it's backed on tape somewhere.
  63. -------------------------------------------------------------------------------
  64.