?
Solved

pattern matchin help needed

Posted on 2007-11-16
2
Medium Priority
?
350 Views
Last Modified: 2010-04-21
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
Comment
Question by:DSwiftie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 1400 total points
ID: 20303020
stored_letters=gaeop
user_input=a
case $user_input in
 [$stored_letters] ) echo already entered that letter ;;
esac
0
 

Author Comment

by:DSwiftie
ID: 20305145
thankyou very much that helped alot m8 cheers
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question