rendered paste body#!/bin/bashcmd=$1rest=$2shiftwhile shiftdo rest="$rest $1"doneif [ "$cmd" = "!triggers" ]then echo "!motd" exit 0fiif [ "$cmd" = '!motd' ]then command=${rest%% *} text=${rest#* } if [ "$command" = "add" ] then echo "$text" >> data/motd_list.txt echo "/PRIVMSG $BOTWHO :Added your motd to the list" elif [ "$command" = "help" ] then echo "Usage: !motd add <message> || search <words> || help -- !motd by itself prints the message of the day" elif [ "$command" = "search" ] then searchtext=`echo $text | tr -d '[:punct:][:cntrl:]'` tac data/motd_list.txt | grep -i "$searchtext" | sed 's/^\///g' > /tmp/motd_$$ linesshown=0 while read output do let linesshown++ if [ "$linesshown" -gt "5" ] then echo "/PRIVMSG $BOTWHO :Greater than 5 results found... please search more specifically" break fi echo "/PRIVMSG $BOTWHO :$output" done < /tmp/motd_$$ rm -f /tmp/motd_$$ else cat data/motd_list.txt | tail -1 | sed 's/^\///g' fifi