I am automating some work that requires calling tcpdump -nn -tt -r on some .pcap files.
To do this I"m using the following tcl code:
set magic_dir "results/pcap/";
set magic_filename "data"
set magic_node_count 16
set magic_command "tcpdump"
for {set i 0} {$i <= $magic_node_count} {incr i} \
{
set filename "${magic_dir}${magic_filename}-${i}-0.pcap"
if {[file exists $filename]} \
{
set dest_dir "${magic_dir}\.\./tmp/tmp_${i}"
exec ${magic_command} -nn -tt -r ${filename} > ${dest_dir}
} \
}
This works (the first file gets converted) but tcl reports an error in that line.
The same thing happens later on in the script when I attempt to use grep. I avoid this by using catch but I would like to know how to properly use this command.
exec -ignorestderr-- tcl.tk/man/tcl8.5/TclCmd/exec.htm - glenn jackman