Per the exec(n) man page you need to replace single quotes with curly braces. You also need [] around exec to invoke it:
set size [exec curl -s -3 --ftp-ssl -k {ftp://xxx:[email protected]:2300/source/} | grep \\.r | awk {{print $5}} | awk {{ SUM += $1} END { print SUM/1024/1024 }}]
That said, you don't need to invoke grep or awk at all. Everything you do with them here can be accomplished within the Tcl code:
proc exact {nick host handle channel text} {
global db_handle network;
set status 0
set error [catch {
set resp [exec curl -s -3 --ftp-ssl -k {ftp://xxx:[email protected]:2300/source/}]
} results options]
if {$error} {
set details [dict get $options -errorcode]
if {[lindex $details 0] eq "CHILDSTATUS"} {
set status [lindex $details 2]
putnow "PRIVMSG $channel :curl error $status"
}
}
set size 0
foreach line [split $resp \n] {
if {[string match {*\\.r*} $line]} {
incr size [lindex $line 4]
}
}
putnow "PRIVMSG $channel :source has [expr {$size/1024/1024}]"
}
(I assume you've meant $channel rather than #chnnel.)
setline is not correct. I think you need to wrap theexecand command (in[]) to evaluate it and quote the command as a string ({}). - Etan Reisnerawk '/\.r/{ SUM += $5} END { print SUM/1024/1024 }'- Ed Morton{braces}have the same functionality as the shell's'single quotes'- glenn jackman