• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

pattern matchin help needed

Hi guys i've been tryin to write a hangman game unix script and i've got a bit stuck on the hardest bits no. I'm first tryin to get a way to way to check if the inputed letter matches the other letters already inputed.

eg lets say the user has already inputed
"stored_letters=gaeop"

if they try to input "user_input=a" i need to refuse that entry since they have already entered that letter. I'm thinkin the way to do this is by cutin each letter of stored_letter and checking it aginstuser_input in a whle loop. My problem is i cant seem to write the code for this you hlp will be well appriciated.

thnx in advance
0
DSwiftie
Asked:
DSwiftie
1 Solution
 
ozoCommented:
stored_letters=gaeop
user_input=a
case $user_input in
 [$stored_letters] ) echo already entered that letter ;;
esac
0
 
DSwiftieAuthor Commented:
thankyou very much that helped alot m8 cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now