Hi, i've got a smal tcl code that reads the contents of a file for devices, eth0, eth1 etc...
the devs file contains all of the items in the list, but it only returns the last item that matches in the dev file, i know its something to do with the IF's, but i just can't get my head arounfd the correct layout. could any suggest the correct layout?
set devices "/proc/net/dev"
set file [ open $devices r ]
set data [read -nonewline $file]
close $file
set lines [split $data "\n"]
foreach line $lines {
if [string match "*lo:*" $line] {
set lo lo
} else { set lo ""}
if [string match -noc "*eth0:*" $line] {
set eth0 eth0
} else { set eth0 ""}
if [string match -noc "*eth1:*" $line] {
set eth1 eth1
} else { set eth1 ""}
if [string match -noc "*ppp0:*" $line] {
set ppp0 ppp0
} else { set ppp0 ""}
if [string match -noc "*ppp1:*" $line] {
set ppp1 ppp1
} else { set ppp1 ""}
}