Hi, OOI,

When you input
/sbin/ifconfig eth1 | grep HWaddr | awk '{print $5; }'
in console, then it will work fine. Because shell(interpreter) can parse
your command and fork three processes, ifconfig eth1, grep HWaddr, and
awk '{print $5; }' these are connected by pipe.

But your code
KL>   proc1 = rt1.exec("/sbin/ifconfig eth1 | grep HWaddr | awk '{print $5; }' ");
must not work because pipe "|" and followed commands will be passed to ifconfig as 
arguments.

So you should write
proc 1 = rt1.exec("/bin/sh -c \"/sbin/ifconfig eth1 |grep HWaddr | awk '{print \\$5; 
}'\"");
or use shell script like following.
---snip
#!/bin/sh
/sbin/ifconfig eth1 |grep HWaddr |awk '{print $5; }'
---snip

I highly recommend shell script because it is easy to change commands.

Regards,
Watanabe

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to