This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:ccaccia:portfolio:project2 [2011/12/15 17:11] – [Execution] ccaccia | user:ccaccia:portfolio:project2 [2011/12/15 20:37] (current) – [Attributes] ccaccia | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Project: | ||
+ | |||
+ | A project for UNIX/Linux Fundamentals by Christopher M. Caccia during the 2011 Fall Semester. | ||
+ | |||
+ | This project was begun on November 15th and has taken 2 months to complete. | ||
+ | =====Objectives===== | ||
+ | |||
+ | The purpose of this project is to create an IRC Bot that when asked a specific question will respond with output to the bot channel on a IRC server. | ||
+ | =====Prerequisites===== | ||
+ | In order to successfully accomplish/ | ||
+ | |||
+ | * Bash shell scripting | ||
+ | * Variable Assigning | ||
+ | * Using " | ||
+ | * Vi Text Editing | ||
+ | * Redirecting text to a file called in (> in) | ||
+ | * Utilizing the sleep command | ||
+ | * The who command | ||
+ | * The cal command | ||
+ | |||
+ | =====Background===== | ||
+ | |||
+ | IRC bots are computer programs that run in a IRC chat room, that when asked a question or statement, will independently respond to you. I feel that the bots really give the perception of artificial intelligence. | ||
+ | |||
+ | Lets get started on creating an IRC bot! | ||
+ | =====Scope===== | ||
+ | |||
+ | To get a better understanding of bash shell scripting I will create a IRC bot that when asked a specific question will return an answer to output in the IRC server channel. | ||
+ | |||
+ | Below I have listed the statements my IRC bot will be programed to answer: | ||
+ | |||
+ | 1.) hi | ||
+ | |||
+ | 2.) calender | ||
+ | |||
+ | 3.) who is the best long cat ever | ||
+ | |||
+ | 4.) who is on | ||
+ | |||
+ | 5.) what is your name | ||
+ | |||
+ | 6.) you are broken | ||
+ | |||
+ | 7.) quit | ||
+ | |||
+ | =====Attributes===== | ||
+ | State and justify the attributes you'd like to receive upon successful approval and completion of this project. | ||
+ | |||
+ | * __Commands__: | ||
+ | * __Files & Directories__: | ||
+ | * __Text Processing__: | ||
+ | * __The UNIX shell__: Assigning variables like BOT, CHAN, SERV, and CMD | ||
+ | * __Job Control & Multitasking__: | ||
+ | * __Scripting__: | ||
+ | * __Security__: | ||
+ | * __System Administration__: | ||
+ | =====Procedure===== | ||
+ | The actual steps taken to accomplish the project. Include images, code snippets, command-line excerpts; whatever is useful for intuitively communicating important information for accomplishing the project. | ||
+ | |||
+ | We will start by opening up VI text editor and creating a file called bigdaddybot. | ||
+ | |||
+ | Once the script was written and all the responses where redirected to a " | ||
+ | |||
+ | |||
+ | |||
+ | =====Code===== | ||
+ | |||
+ | <code c> | ||
+ | #!/bin/bash | ||
+ | |||
+ | pkill ii 2>/ | ||
+ | |||
+ | BOT=" | ||
+ | CHAN="# | ||
+ | SERV=" | ||
+ | |||
+ | ii -s $SERV -n $BOT & | ||
+ | PID=$$ | ||
+ | cd ~/irc/irc | ||
+ | echo "/join $CHAN" > in | ||
+ | cd " | ||
+ | echo "You have been infected by Bigdaddy" | ||
+ | CMD=" | ||
+ | while [ ! " | ||
+ | if [ " | ||
+ | echo "Whats going on?.... Dude! I think your zipper is down!" > in | ||
+ | fi | ||
+ | if [ " | ||
+ | echo "Hang on please......" | ||
+ | sleep 2 | ||
+ | cal > in | ||
+ | echo " There You Go!" > in | ||
+ | fi | ||
+ | if [ " | ||
+ | echo "Who the heck do you think" > in | ||
+ | sleep 2 | ||
+ | echo "The best long cat ever, would have to be...." | ||
+ | sleep 2 | ||
+ | echo "J I M M Y.... of course!" | ||
+ | fi | ||
+ | if [ " | ||
+ | echo "Good Question!" | ||
+ | sleep 1 | ||
+ | who > in | ||
+ | sleep 1 | ||
+ | echo " I think that's everyone!" | ||
+ | fi | ||
+ | if [ " | ||
+ | sleep 1 | ||
+ | echo "They call me... Bigdaddy!" | ||
+ | fi | ||
+ | |||
+ | if [ " | ||
+ | sleep 2 | ||
+ | echo " No i'm not! You are a moron!" | ||
+ | sleep 2 | ||
+ | fi | ||
+ | sleep 2 | ||
+ | CMD=" | ||
+ | |||
+ | done | ||
+ | echo "/ | ||
+ | exit | ||
+ | |||
+ | </ | ||
+ | |||
+ | =====Execution===== | ||
+ | This is the process for running my bot program from a terminal. | ||
+ | |||
+ | <cli> | ||
+ | lab46:~$ cd bash | ||
+ | lab46: | ||
+ | [1] 22144 | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | =====Reflection===== | ||
+ | |||
+ | This project really helped me with the basics of shell scripting and how it can be implemented within everyday use of a irc chat channel. | ||
+ | =====References===== | ||
+ | In performing this project, the following resources were referenced: | ||
+ | |||
+ | * http:// | ||
+ | * http:// | ||
+ | * Sleep man page | ||
+ | * ii man page | ||
+ | |||