![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date Validation: | satyam_sat | Shell Programming and Scripting | 1 | 04-02-2008 03:17 AM |
| how do I make dynamic parameter names? Or get the value of a parameter evaluated twi | Awanka | Shell Programming and Scripting | 2 | 04-19-2007 06:37 PM |
| Filename Validation | F-1 | UNIX for Advanced & Expert Users | 2 | 05-02-2006 10:29 AM |
| Data Validation | ericelysia | UNIX for Dummies Questions & Answers | 2 | 12-15-2005 05:06 AM |
| String validation | DeepakXavier | Shell Programming and Scripting | 3 | 10-09-2005 07:43 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
validation on a parameter
Hi guys!
Im tryin to set up a login script that allows a user to login with only the following "forename.surname" . The username all contain lowercase letters so thats not a problem to sort out, but im having problems making sure that they can only enter 1 " . " . the code i have so far is this which i thought should work but always comes out as false: Code:
file=$1 if [ "$file" != '[a-z]\.' ] then echo File must contain a dot! fi exit 0 if [ "$file" = '[a-z]\..' ] then echo File must contain no more than 1 dot! fi exit 0 Please help feel so thick! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Try the trusty old case statement.
Code:
case $file in *.*.*) echo Many dots;; *.*) echo Fine;; *) echo No dots;; esac |
|||
| Google The UNIX and Linux Forums |