can some please give driection as to how to archieve this big issue i am having:
I a random number that has been generated and wants the user to guess it, let me illustrate this:
say the random i hve generated is 'nice'
i then hide it from the user and display it in ----
-but now if the use enter 'n' because it is in the random word, i would then display to them n---
and so until they get all the letters
i have used a while loop, but i seem to be loosing previously guessed letters
# pseudo code
random_word=`generate_random_word`
guessed_letters=`echo $random_word | sed -e 's/./-/gp'`
guesses=0
max_guesses=26
while ( $random_word != $guessed_letters && $guesses < $max_guesses ) {
# If the input can be found in $random_word,
# replace the same position in $guessed_letters with that input.
#
# ++$guesses
print $guessed_letters
}