Quote:
Originally Posted by strasner
im trying to write an until statement which dont go onto the next stage until the user inputs a certain phrase. It is then stored in an array. Ive come up with this code so far but its not working and i dont know why.
Code:
read in1
until [ $in1 = 'lt' || $in1 = 't' || $in1 = 'rt' ]
do
echo "Incorrect, try again"
read in1
done
arr[$i]=$in1
please help me
|
This line:
Code:
until [ $in1 = 'lt' || $in1 = 't' || $in1 = 'rt' ]
should be:
Code:
until [ $in1 = 'lt' -o $in1 = 't' -o $in1 = 'rt' ]
Or with the ksh syntax:
Code:
until [[ $in1 = 'lt' || $in1 = 't' || $in1 = 'rt' ]]
|