diff options
author | julien | 2009-08-19 12:22:40 +0200 |
---|---|---|
committer | julien | 2009-08-19 12:22:40 +0200 |
commit | d0675339023114166a1f0da81fb49c3ee68d0c18 (patch) | |
tree | 6b2517b1fd4dd8520ddf2710b27f1243797a0db8 /shquote.sh | |
parent | Refactored command handling (diff) | |
download | shbot-d0675339023114166a1f0da81fb49c3ee68d0c18.tar.gz shbot-d0675339023114166a1f0da81fb49c3ee68d0c18.tar.bz2 shbot-d0675339023114166a1f0da81fb49c3ee68d0c18.zip |
Added the quote module
Diffstat (limited to '')
-rwxr-xr-x | shquote.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/shquote.sh b/shquote.sh new file mode 100755 index 0000000..82076fb --- /dev/null +++ b/shquote.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -n "$2" ]; then + ARGS=$* && ARGS=($ARGS) + OWNER=$1 + LEN=`expr ${#ARGS[*]}` + QUOTE=${ARGS[@]:1:$LEN} + + echo "${OWNER}" >> shquote.txt + echo "${QUOTE}" >> shquote.txt +#elif [ -n "$1" ]; then + # TODO : quote someone +else + NB_LINES=(`wc -l shquote.txt`) + LINE=$((RANDOM * NB_LINES[0] / 65534)) + + # IFS="\r" LINES=(`tail -n $((LINE + 2)) shquote.txt | head -n 2`) + # QUOTE=${LINES[0]} + # OWNER=${LINES[1]} + QUOTE=`tail -n $((LINE * 2 + 1)) shquote.txt | head -n 1` + OWNER=`tail -n $((LINE * 2 + 2)) shquote.txt | head -n 1` + echo "\"${QUOTE}\"" + echo "-- ${OWNER}" +fi + |