Functional code.
This commit is contained in:
parent
923ca7f055
commit
ff0632fc0f
36
d6.sh
36
d6.sh
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
# This is free and unencumbered software released into the public domain.
|
# This is free and unencumbered software released into the public domain.
|
||||||
#
|
#
|
||||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
@ -86,7 +86,33 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "NUM_WORDS=$NUM_WORDS"
|
WORDS=""
|
||||||
echo "WORDLIST=$WORDLIST"
|
|
||||||
echo "DELIMITER=$DELIMITER"
|
for i in $(seq 1 $NUM_WORDS)
|
||||||
echo "CASE=$CASE"
|
do
|
||||||
|
ROLLS=""
|
||||||
|
for j in {1..5}
|
||||||
|
do
|
||||||
|
ROLLS="$((1 + $RANDOM % 6))$ROLLS"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $CASE == "upper" ]
|
||||||
|
then
|
||||||
|
WORD="$(awk "/$ROLLS/{ print toupper(\$2) }" $WORDLIST)"
|
||||||
|
elif [ $CASE == "lower" ]
|
||||||
|
then
|
||||||
|
WORD="$(awk "/$ROLLS/{ print tolower(\$2) }" $WORDLIST)"
|
||||||
|
else
|
||||||
|
WORD="$(awk "/$ROLLS/{ print \$2 }" $WORDLIST)"
|
||||||
|
WORD="${WORD^}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $i -eq $NUM_WORDS ]
|
||||||
|
then
|
||||||
|
WORDS="${WORDS}${WORD}"
|
||||||
|
else
|
||||||
|
WORDS="${WORDS}${WORD}${DELIMITER}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "$WORDS"
|
||||||
|
Loading…
Reference in New Issue
Block a user