The UNIX and Linux Forums  

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



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #10 (permalink)  
Old 05-15-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,614
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
Adapting it to be stricter for February etc left as an exercise ... Maybe you could put the upper limit of the range in a variable when you read the month.

(I'd hate to use a script which prompts interactively, myself.)
Reply With Quote