Say I have a TCL script like this:
exec ls -l
Now this will print out the content of current directory. I need to take that output as a string and parse it. How I can do this?
exec
returns the output so simply set a variable to it:
set result [exec ls -l]
You may want to wrap this in a catch
however:
if {[catch {exec ls -l} result] == 0} {
# ...
} else {
# ... (error)
}