Posted to tcl by aspect at Wed Nov 09 13:18:33 GMT 2011view pretty
#!/usr/bin/tclsh # # the files I am reading are shell scripts with tgz appended to them, # intended to be read by "tail -n +100 | tar xzv". Why do I need to # [seek $f [tell $f]] after [chan configure]? # foreach fn [glob *.exe] { set basename [lindex [split $fn _.] 1] file mkdir $basename set f [open $fn] while {[set l [gets $f]] != "exit"} {} chan configure $f -encoding binary -translation binary # needing to do this is a bit odd seek $f [tell $f] exec tar -C $basename -xzv <@ $f close $f }