[lug] simple perl/bash question

j davis davis_compz at hotmail.com
Sat Apr 20 17:02:40 MDT 2002


hi,

so im trying this in a perl scrp

@interface = `ifconfig |grep eth | cut -f 1 -dL`;


foreach $interface (@interface){
	print "$interface current ip ";
	print `ifconfig | grep -C $interface | grep inet | cut -f2 -d: | cut -f1 
-dB`;
}

except its not wraped when i run it...anyway it seems as if
$interface comes with a <enter> tacked on...is there a way to strip this off 
or a easy way to get the ip of a specific interface...i would perfer to know 
how to make the ` ifconfig |
grep -C $interface..... way work because i uderstand how the
ip is got.

thanks,
jd







_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




More information about the LUG mailing list