scripts

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

commit 91aa76b20a26f49acebcfbe36a907fcebc8eca65
parent 951ee5714be3d8c99cc2471105d7033e7e6b10c6
Author: Willy Goiffon <w.goiffon@gmail.com>
Date:   Tue Oct  1 08:19:52 +0200

Changed script name and added options

Diffstat:
chan | 30------------------------------
chat | 42++++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 30 deletions(-)
diff --git a/chan b/chan @@ -1,30 +0,0 @@ -#!/usr/bin/bash - -## ii directory -ROOT=~/var/irc - -# irc parameters -NICK='amoureuse' -SERV='irc.freenode.net' -PORT='6667' -CHAN='z3bra' - -[[ -n "$1" ]] && CHAN=$1 - -# commands launched on startup -JOIN="/j $CHAN yop yop" - -# 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 @@ -0,0 +1,42 @@ +#!/usr/bin/bash + +## ii directory +ROOT=~/var/irc + +# irc parameters +NICK='ptii' +SERV='irc.freenode.net' +PORT='6667' +CHAN='z3bra' + +[[ -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