Hello there peeps:
There is a little piece of bash shell scripting problem i have, which i was hoping you could help me with.
#!/bin/bash
stored_word()
{
case $(( $$ % 8 )) 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 "advertisement" ;;
#11 ) echo "heading" ;;
#12 ) echo "distasteful" ;;
#13 ) echo "fashioned" ;;
#14 ) echo "variation" ;;
#15 ) echo "individual"
esac
}
The code is suppose to generate a random word and insert it here:
word=$(stored_word)
letters=$(echo $word | wc -c)
letters=$(( $letters - 1 ))
template="$(echo $word | tr '[a-z A-Z 0-9]' '.')"
remaining=$letters
the rest of the script i havent bothered pasting here, but i will if you guys will need to have a look at it.
Simply what i am trying to achieve is, for the function stored_word to generate a random word and then insert it into $word, which dose. then the 2nd piece of code, mixes it all up. The main problem is they are in the same script and need to be in 2 different script. How can i achieve that, without using sed or awk?
Keyvan