The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-24-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,345
Quote:
Originally Posted by strasner View Post
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' ]]