![]() |
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 |
| Another newb question: how to use test for zero-length string ? | lumix | Shell Programming and Scripting | 4 | 12-15-2007 05:43 PM |
| ksh - test if string contains alphanumeric... | tugger | Shell Programming and Scripting | 3 | 10-16-2007 04:23 AM |
| test if a filename exists with specified string (ksh) | bob122480 | Shell Programming and Scripting | 6 | 01-21-2007 03:47 PM |
| C function to test string or integer | qqq | High Level Programming | 3 | 03-10-2005 01:55 AM |
| string test? | hedrict | UNIX for Dummies Questions & Answers | 9 | 03-29-2002 03:57 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
what is the goal ?
must your number be min 4 digits ? must your number be min and max 4 digits ? there are several options I prefer the following subtract 999 from your number and check the result to see if this is bigger than 0 => this way you know your number is at leaset 1000 subtract 9999 from your number and check the result to see if this is lower than 1 => this wat you know your number is max 9999 vb: [dummy920]@@ecar0o:/home/oracle> t=8 [dummy920]@@ecar0o:/home/oracle> ((a=$t-999)) [dummy920]@@ecar0o:/home/oracle> if (( $a > 0 )) more>then more>echo "min 4 digits" more>else more>echo "too small" more>fi too small [dummy920]@@ecar0o:/home/oracle> t=10000 [dummy920]@@ecar0o:/home/oracle> ((a=$t-9999)) [dummy920]@@ecar0o:/home/oracle> if (( $a < 1 )) more>then more>echo "max 4 digits" more>else more>echo "too big" more>fi too big |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|