The UNIX and Linux Forums  

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
Script needed to select and delete lower case and mixed case records abhilash mn Shell Programming and Scripting 1 03-17-2008 05:00 AM
To CASE or not to CASE, this is my question! olimiles Shell Programming and Scripting 1 08-19-2006 01:54 AM
Ignore case sensitive in Case Switch annelisa Shell Programming and Scripting 1 07-13-2006 01:36 AM
how can I restart X server ? oneivan UNIX for Dummies Questions & Answers 6 10-16-2002 06:45 AM
lower case to upper case string conversion in shell script dchalavadi UNIX for Dummies Questions & Answers 3 05-28-2002 09:07 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-19-2004
Registered User
 

Join Date: Sep 2004
Posts: 78
Question restart case ?

simple short question...

when you make a case instruction..

read f
echo " "
case $f in
0) echo "0" ;;
1) echo "1" ;;
2) echo "2" ;;
*) echo "unknown";; # how to restart case from line 'read f' ?
esac

...just wanna get to the entry when making a false entry.
there isn't a chance of goto read f.

can anyone help ? thx..
Reply With Quote
Forum Sponsor
  #2  
Old 10-19-2004
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Code:
f=0
while [ $f -ge 0 ]
do
  echo "Enter A Value: \c"
  read f
  echo " "
  case $f in 
      0)
         echo "0"
         break
         ;;
      1)
         echo "1"
         break
         ;;
      2)
         echo "2"
         break
         ;;
      *)
         echo "unknown"
         ;; 
   esac 
done
Reply With Quote
  #3  
Old 10-19-2004
Registered User
 

Join Date: Sep 2004
Posts: 78
Exclamation

thx...but it's not really working

but I've found your intention...make a while loop (infinite loop for *) and break by the others ( 1,2,3...)

...
echo "in: \c"
while read f
do
case $f in
0) echo "0"
break;;
1) echo "1"
break;;
*) echo "unknown command $f - retry"
;;
esac
done

now it's working.....cya
Reply With Quote
  #4  
Old 10-19-2004
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Huh, worked for me. Must be a difference in shell. I am using Korn on an HPUX 11.0 server
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0