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 the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-16-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Basic Bourne doesn't have regular expressions in the [ command, no. You can use case in this case (sic) though.

Code:
case $reply in [0-9][0-9][0-9][0-9][0-9]) rejoice;; esac
The case statement uses basic glob patterns, not full regular expressions. The expr command supports regular expressions, and many modern Bourne-compatible shells have extensions which add regex support to the shell itself.