diff options
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 + |