The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rsync - exclude statement not working em23 Shell Programming and Scripting 1 08-21-2008 06:47 PM
How is use sselect statement o/p in insert statement. nkosaraju Shell Programming and Scripting 2 08-06-2008 09:26 PM
If statement not working Hazmeister Shell Programming and Scripting 6 12-13-2007 04:33 AM
korn shell to bash - statement not working brdholman UNIX for Dummies Questions & Answers 5 10-15-2007 09:49 AM
find/if statement not working geomonap Shell Programming and Scripting 12 12-16-2005 09:56 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-24-2009
strasner strasner is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 16
until statement not working

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
  #2 (permalink)  
Old 06-24-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,212
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' ]]
  #3 (permalink)  
Old 06-24-2009
strasner strasner is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 16
thanks alot, youve saved my morning
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0