set script_bin {/home/egg/scripts/script.sh}

## depending on what you are wanting...you can probably remove this setting and just use $chan now
set my_channel "#chan"

## set the flag here
setudef flag script

proc script_proc_bind_cmd {nick uhost hand chan text} {

         ## check if this channel is set +script
         #if {![channel get $chan script]} {return}
         #if {![string equal [lrange [split $text] 0 1] "hello world"]} {return}

         ## we could also combine both of these if statements into one
         if {![channel get $chan script] || ![string equal [lrange [split $text] 0 1] "hello world"]} {return}

         set text [lrange [split $text] 2 end]
         set output [exec $::script_bin [lindex $text 0]]
         ## since we are only working on certain channels now...we can change this to just $chan if you want
         putserv "PRIVMSG $::my_channel :$output"
}

bind pubm -|- "*hello world*" script_proc_bind_cmd