scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 9b0a991f864c97fa390b098b37b5ad7bd460b41c
parent e584dab35b77d87e7d2585d7c49f2bc1f1eefc9e
Author: z3bra <willy@mailoo.org>
Date:   Wed Feb  5 13:39:12 +0100

changed chat name to chan

Diffstat:
chan | 48++++++++++++++++++++++++++++++++++++++++++++++++
chat | 48------------------------------------------------
2 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/chan b/chan @@ -0,0 +1,48 @@ +#!/usr/bin/bash + +## ii directory +ROOT=~/var/irc + +# irc parameters +NICK='ptii' +SERV='irc.freenode.net' +PORT='6667' +CHAN='z3bra' + +usage() { + cat << EOF + usage: chat [-h] [-s server] [-c channel] [-n nickname] +EOF +} + +[[ -n "$1" ]] && CHAN=$1 +[[ -n "$2" ]] && NICK=$2 + +while getopts ":hn:c:s:" opt; do + case $opt in + h) usage; exit 0;; + n) NICK=$OPTARG;; + s) SERV=$OPTARG;; + c) CHAN=$OPTARG;; + ?) echo "Invalid option -$OPTARG"; exit 1;; + *) usage; exit 1;; + esac +done + +# commands launched on startup +JOIN="/j $CHAN hai $CHAN!" + +# spawn ii +ii -i $ROOT -n $NICK -s $SERV -p $PORT & + +while [ ! -p $ROOT/$SERV/in ];do echo awaiting connection to $SERV...; sleep 2; done + +# launch commands at start +echo "$JOIN" > $ROOT/$SERV/in + +while [ ! -p $ROOT/$SERV/$CHAN/in ];do echo Starting chatting with $CHAN; sleep 1; done + +cd $ROOT/$SERV/$CHAN +tmux new-session -d -s irc 'tail -f out' \; split-window -l 1 'ptii' \; attach + +rm -rf $ROOT/$SERV diff --git a/chat b/chat @@ -1,48 +0,0 @@ -#!/usr/bin/bash - -## ii directory -ROOT=~/var/irc - -# irc parameters -NICK='ptii' -SERV='irc.freenode.net' -PORT='6667' -CHAN='z3bra' - -usage() { - cat << EOF - usage: chat [-h] [-s server] [-c channel] [-n nickname] -EOF -} - -[[ -n "$1" ]] && CHAN=$1 -[[ -n "$2" ]] && NICK=$2 - -while getopts ":hn:c:s:" opt; do - case $opt in - h) usage; exit 0;; - n) NICK=$OPTARG;; - s) SERV=$OPTARG;; - c) CHAN=$OPTARG;; - ?) echo "Invalid option -$OPTARG"; exit 1;; - *) usage; exit 1;; - esac -done - -# commands launched on startup -JOIN="/j $CHAN hai $CHAN!" - -# spawn ii -ii -i $ROOT -n $NICK -s $SERV -p $PORT & - -while [ ! -p $ROOT/$SERV/in ];do echo awaiting connection to $SERV...; sleep 2; done - -# launch commands at start -echo "$JOIN" > $ROOT/$SERV/in - -while [ ! -p $ROOT/$SERV/$CHAN/in ];do echo Starting chatting with $CHAN; sleep 1; done - -cd $ROOT/$SERV/$CHAN -tmux new-session -d -s irc 'tail -f out' \; split-window -l 1 'ptii' \; attach - -rm -rf $ROOT/$SERV