Code: Select all
exec <code-here>
Code: Select all
set testing [exec rm /home/user/test.txt]
putserv "PRIVMSG $chan :$testing"
Code: Select all
set testing2 [exec some.sh]
putserv "PRIVMSG $chan :$testing2"
Code: Select all
bind pub - !shell shellcommand
proc shellcommand { nick uhost handle chan text } {
set docmd [exec $text]
putserv "PRIVMSG $chan :$docmd"
}
DaRkOoO wrote:It works,but..
<snipped irrelevant parts>
He paste just one line,never more..For example !shell who,he will paste just first line and then stop..Can that be fixed?
Code: Select all
bind pub mn|- !shell shellcommand
proc shellcommand { nick uhost handle chan text } {
set result [exec [list $text]]
if {[string llength $result]} {
foreach line [split $result "\n"] {
putserv "PRIVMSG $chan :$line"
}
}
}
Code: Select all
bind pub n !shell shellcommand
proc shellcommand {nick host handle channel text} {
set cmdline [split $text]
if {[catch {eval [linsert $cmdline 0 "exec"]} status]} {
puthelp "PRIVMSG $channel :Executed \"$text\" returned error status:"
foreach line [split $status "\n"] {
puthelp "PRIVMSG $channel :$line"
}
puthelp "PRIVMSG $channel :errorInfo:"
foreach line [split $::errorInfo "\n"] {
puthelp "PRIVMSG $channel :$line"
}
} {
puthelp "PRIVMSG $channel :Executed \"$text\" returned ok status:"
foreach line [split $status "\n"] {
puthelp "PRIVMSG $channel :$line"
}
}
}