tcl - array allowed not allowed -
i have script "proc backup". have each directory many words allowed or not allowed. thought integrade array. not ahead ...
or there simpler?
bind pubm - "*fertig*" backup proc backup {nick host handle channel text} { set name[lindex [split [stripcodes bcru $text]] 2] set dir[lindex [split [stripcodes bcru $text]] 4] if {[catch {exec sh backup.sh $dir $name} error]} { putlog $error } putnow "privmsg $channel :backup $name done"; } array set allowed { "dir1" "to rar" "dir2" "backupserver1 " "dir3" "2016 2017" } array set not_allowed { "dir1" "test crap" "dir2" "old backupserver2 jpg zip" "dir3" "2015 2014 2013 2012 2011 2010 209 19" }
edit :
line irc: ( lindex 2 , 4)
run backup.sh when word in name is
word0 word1 backupserver1 word3 dir2
not run backup when word is
word0 word1 backupserver55 word3 dir2
not run backup.sh
word0 word1 test word3 dir1 word0 word1 crap word3 dir1
run backup.sh when word in name is
word0 word1 black word3 dir1
only run when word set allowed in $name is. not run when word not_allowed in $name is.
Comments
Post a Comment