My problem is as follow and i hope you can help:
I currently have this function:
Code:
stored_word()
{
number=$RANDOM
let "number %= 21"
case $number in
0 ) echo "energy" ;; 1 ) echo "touch" ;;
2 ) echo "climbing" ;; 3 ) echo "declare" ;;
4 ) echo "marry" ;; 5 ) echo "relax" ;;
6 ) echo "bugs" ;; 7 ) echo "inaccessible" ;;
8 ) echo "country" ;; 9 ) echo "folder" ;;
10 ) echo "individual" ;; 11 ) echo "youngest" ;;
12 ) echo "disco" ;; 13 ) echo "disturbed" ;;
14 ) echo "company" ;; 15 ) echo "scientific" ;;
16 ) echo "disaster" ;; 17 ) echo "protection" ;;
18 ) echo "curiously" ;; 19 ) echo "deranging" ;;
21 ) echo "facilities"
esac
}
then i recalled it using the Dot command suggested here into my script as follow:
Code:
. hangman_words
word=$(stored_word)
letters=$(echo $word | wc -c)
letters=$(( $letters - 1 ))
template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
remaining=$letters
works fine, but the words should not be in a function or hard coded... and tbh i am not what i need to do, to create a word randomly, and
sed and awk are out of question as well.
Can any one shed a light on this please?
K