#!/bin/bash # ## you might wanna reset your terminal colors ## after you exit with "$ reset" ## ## dont forget these vars can be hardcoded ## but to disambiguate ... # read -p "Enter CHANNEL: " CHANNEL read -p "Enter NICK: " NICK # Start chan_mesg_col=$(echo -e "\e[2m") chan_user_col=$(echo -e "\e[0;33m") quit_mesg_col=$(echo -e "\e[1;30;40m") nick_flip_col=$(echo -e "\e[1;35m") part_mesg_col=$(echo -e "\e[1;36m") join_mesg_col=$(echo -e "\e[0;32m") trap "echo Ouch! PRESS qq to exit !!! " SIGINT #CHANNEL="#grub4dos" #NICK="some_user" USER="$NICK" exec 4>/dev/tcp/irc.freenode.net/6667 echo "NICK $NICK" >&4 echo "USER $USER 8 * : something else" >&4 echo "JOIN $CHANNEL" >&4 cat <&4 & while : do cat <&4 | while read line;do _source=($line) _channel_name=${_source[2]} _channel_mesg=${_source[*]:3} _user_raw=${_source[0]%%!*} _user_name=${_user_raw#*:} _server_mesg=${_source[1]} _ping_mesg=${_source[0]} case "${_ping_mesg}" in "PING") echo "PONG" >&4 ;; esac case "${_server_mesg}" in "JOIN") echo "${join_mesg_col}${_source[*]}" ;; "NICK") echo "${nick_flip_col}${_source[*]}" ;; "PART") echo "${part_mesg_col}${_source[*]}" ;; "QUIT") echo "${quit_mesg_col}${_source[*]}" ;; *) echo "${chan_user_col}${_user_name}@${_channel_name} ${chan_mesg_col}${_channel_mesg}" ;; esac done & read MESG if [ "$MESG" = " " ]; then clear elif [ "$MESG" = "qq" ]; then echo "QUITTING !!! " echo "quit" >&4 exit elif [ "$MESG" = ":" ]; then read -p "Send to Server: " SERV_MESG echo "$SERV_MESG" >&4 else echo "PRIVMSG $CHANNEL :$MESG" >&4 fi done # End