Hi all,
 
I would like to grep my linux MAC address, the command to run under linux should be like this
ifconfig eth1 | grep HWaddr | awk '{print $5; }'
 
Therefore i wrote it like below...
 
But it failed.....
 
Anyone can help?? Thanks.
 
Regards
KL
 
*********************************
  Process proc1=null;
  Runtime rt1 = Runtime.getRuntime();
  
  proc1 = rt1.exec("/sbin/ifconfig eth1 | grep HWaddr | awk '{print $5; }' ");
  
  BufferedReader result = new BufferedReader(new InputStreamReader(proc1.getInputStream()));
  BufferedReader error = new BufferedReader(new InputStreamReader(proc1.getErrorStream()));
 
  String str_result = null;
  String str_error = null;
 
  while ( ( str_result = result.readLine()) != null)
  {
   out.println(str_result);
  }
 
  while ( ( str_error = error.readLine()) != null)
  {
   out.println(str_error);
  }
*********************************
 
 
 
 
Best regards,
KL OOI
Senior Software Engineer
iBridge Capital Technology Solutions Limited
 
General: (604)818-0988
Fax: (604)818-0698
DID: (604)818-0618
Mobile: (6012)421-7772
Email: [EMAIL PROTECTED]
URL: www.ibridgecapital.com

Reply via email to