tChanged script name and added options - scripts - various script and utils
(HTM) git clone git://z3bra.org/scripts
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 91aa76b20a26f49acebcfbe36a907fcebc8eca65
(DIR) parent 951ee5714be3d8c99cc2471105d7033e7e6b10c6
(HTM) Author: Willy Goiffon <w.goiffon@gmail.com>
Date: Tue, 1 Oct 2013 08:19:52 +0200
Changed script name and added options
Diffstat:
D chan | 30 ------------------------------
A chat | 42 +++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 30 deletions(-)
---
(DIR) diff --git a/chan b/chan
t@@ -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
(DIR) diff --git a/chat b/chat
t@@ -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