The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
CEP vs the hype cycle iBot Complex Event Processing RSS News 0 02-05-2008 02:20 PM
For cycle nagomes Shell Programming and Scripting 3 06-08-2007 02:48 AM
Stopping a command during the cycle chapmana UNIX for Dummies Questions & Answers 7 11-25-2006 01:08 PM
shell cycle mape Shell Programming and Scripting 2 07-14-2006 12:12 AM
Find wildcard .shtml files in wildcard directories and removing them- How's it done? Neko UNIX for Dummies Questions & Answers 1 06-27-2001 06:06 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-18-2008
Registered User
 

Join Date: Mar 2008
Posts: 3
Stumble this Post!
wildcard in a if cycle

hello everybody,
I need help on putting a wildcard match inside an if condition (I'm using korn shell):

if [ $MYSEL -ne [0-5] ]
then echo ' '
echo ''$MYSEL' is not a correct option'
echo ' '
else .....

i tried also #if -ne "`[0-5]`" and a lot of combinations of `"' but I didn't find the correct one...i want to match as condition all values differents from 0 to 6 numbers

thanks a lot for the help
Elio
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-18-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,851
Stumble this Post!
Code:
if [[ $MYSEL -lt 0 || $MYSEL -gt 5 ]] then
         echo "bad"
else
         echo "good"
fi
Reply With Quote
  #3 (permalink)  
Old 04-18-2008
Registered User
 

Join Date: Mar 2008
Posts: 3
Stumble this Post!
thanks a lot, you are my hero
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:09 PM.


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

Content Relevant URLs by vBSEO 3.2.0