![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| [csh] checking for specific character ranges in a variable | userix | Shell Programming and Scripting | 5 | 05-11-2008 07:56 AM |
| Ksh Checking if string has 2 characters and does not contain digits? | developncode | UNIX for Dummies Questions & Answers | 1 | 04-08-2008 03:19 PM |
| Eliminate variable checking in a script | BMetelsky | Shell Programming and Scripting | 8 | 12-04-2007 10:59 AM |
| checking valid values in variable | MizzGail | Shell Programming and Scripting | 3 | 10-23-2006 03:20 PM |
| checking a variable is within range | Poison Ivy | Shell Programming and Scripting | 2 | 08-17-2006 05:33 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
ksh Checking if variable has 5 digits
How could I check if a numeric variable has 5 digits in KSH...I have a zipcode variable that I know will always be 5 digits, and I want to print out an error if it is less or more than 5 digits the problem is that I have it as:
if [[ $zipcode -gt 99999 || $zipcode -lt 00001 ]] but this won't work because the statement doesn't see 0001 as being less than 00001...pls help. |
|
||||
|
Or even
Code:
case $var in ?????) continue;; *) yikes; oops; er um --whoa;; esac I hope you know that if your audience is international, "ZIP code" is not very universal. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|