Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limit of signs in the ksh-command 'read'

Status
Not open for further replies.

neo1977

IS-IT--Management
Jan 5, 2004
1
DE
#!/bin/ksh

sorry for my english, I'm from Germany.

How can I limit the number of signs in an interactive Query?
I must start one interactive query where the petition must be at least and maximum 8 signs long.

In the past, I had to play a quiz in an IBM AIX Training.
In this quiz was a gap text. Points were predefined in the answers, that exactly corresponded with the number of signs of the answer. The entered letters then replaced the points.

Anybody knows an answer?

Thanks in advance
 
I'm not sure what is meant by "signs", but this will only allow an answer of exactly 8 characters...
[tt]
unset ANSWER
until [[ ${#ANSWER} -eq 8 ]]
do
echo Question : ........
tput cuu1
echo Question : \\c
read ANSWER
done
echo Answer : $ANSWER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top