How to execute shell commands?

Old posts that have not been replied to for several years.
Locked
e
evenfall

How to execute shell commands?

Post by evenfall »

It is possible and how to execute external shell command? Like ifconfig for example or uptime.
Can anyone give me an example of how to run something in shell and grab the output and print it in channel.
M
Meltdown

Post by Meltdown »

either with
set mydata [exec ls]
foreach x $mydata {
#do something with $x
}
or with
set fs [open |ls]
while {![eof $fs]} {
gets $fs data
#do something with $data
}
close $fs
Locked