![]() |
|
|
|
|
|||||||
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. Shell Script Page. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| limiting failed logins to three | csaunders | HP-UX | 1 | 10-18-2007 06:56 AM |
| Aplication user and kernel mode (data access) | Brendan Kennedy | High Level Programming | 1 | 05-27-2007 02:45 PM |
| AIX v.5.1 - system and user data backup | Sezgin | AIX | 5 | 01-08-2007 02:29 AM |
| Limiting length of user in while creating user | Satya Mishra | AIX | 2 | 04-14-2005 11:40 PM |
| Limiting access | misha | UNIX for Dummies Questions & Answers | 4 | 02-24-2001 03:25 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
limiting data inputs for the user
if my user has to enter the name of months to carry out a search how can I limit the input values to only the month names and nothing else?
so far my input criteria for the user is this: Quote:
|
| Forum Sponsor | ||
|
|
|
|||
|
Code:
echo " " echo "Enter the month in which you wish to search (Please enter months in the form of Jan, Feb, Mar, etc...): " read MONTH case $MONTH in [Jj]an|[Ff]eb|[Mm]ar|[Aa]pr|[Mm]ay|[Jj]un|[Jj]ul|[Aa]ug|[Ss]ep|[Oo]ct|[Nn]ov|[Dd]ec);; *) echo "Invalid month name" ;; esac grep $5 "$MONTH" tempfile > tempmonth |
|
|||
|
now that i have done it for months
how do i restrict user inputs for date based on the month chosen? is it: Code:
while true; do echo " " echo "Enter Date of the Month (1-31): " read DATE case $DATE in [1-31]);; *) echo " " echo "Invalid date, try again" >&2;; esac done grep $4 "$DATE" *.hits >tempfile |
|
|||
|
The wildcard is not valid, you are looking for 1-3 or 1.
Code:
case $DATE in [1-9]|[12][0-9]|3[01]) break;; *) echo Invalid date, try again >&2;; esac (I'd hate to use a script which prompts interactively, myself.) |
|
|||
|
ok i have entered this to limit it from dates 1-31
Code:
case $DATE in [1-9]|[12][0-9]|3[01]) break;; *) echo Invalid date, try again >&2;; esac |
| Thread Tools | |
| Display Modes | |
|
|