## probably a good idea to use very unique variable names here since these are in the global namespace
set script_bin {/home/egg/scripts/script.sh}
set my_channel "#chan"


## best practice is to place binds immediatly after the proc they are bound to

## 'args' has special meaning in tcl when used in a proc declaration
## unless you know how to handle it...don't use it here..change to 'text'

proc script_proc_bind_cmd {nick uhost hand chan text} {

         ## see if the first 2 words really were 'hello world' and if not return (stop)
         if {![string equal [lrange [split $text] 0 1] "hello world"]} {return}

         ## if we are still processing then looks like the first 2 words were right
         ## this changes the value of $text to remove the first 2 words and makes it a list
         set text [lrange [split $text] 2 end]

         ## 'global' is a bit deprecated, using namespace calls is alot better
         ## the global namespace is always ::
         ##global script_bin channel

         set output [exec $::script_bin [lindex $text 0]]

         ## unless you ALWAYS want the output to a certain channel...
         ## NOT the channel they are spoken on then this is fine...
         ## Just remember that you get $chan passed here which will 
         ## always be the channel the words were said
         ## also..if your output is more than a line or so, you probably want 'puthelp' here
         putserv "PRIVMSG $my_channel :$output"
}
## -|- is the same as just - for these binds
bind pubm - "*hello world*" script_proc_bind_cmd

## these are all set for the bind types..the variable names
## always in the same order you will get:
## nick user@host handle channel text
## usually listed as: nick uhost hand chan text
## see doc/tcl-commands.doc in your eggdrop directory for all the other binds

proc script_proc_bind_report {nick uhost hand chan text} {

        ## use the namespace call here also..and i changed your global variable name to my_channel
        ##global channel

        ## same thing here as above...if you want it to report to channel where trigger was typed
        ## just use $chan that you get passed by the bind
        ## also...probably DO NOT want putquick here..putserv is fine
        putserv "PRIVMSG $::my_channel :Yes, you got it!"
} 
bind pub - !status script_proc_bind_report
