test filenames for regex patterns in bash

Posted by rk on Server Fault See other posts from Server Fault or by rk
Published on 2010-04-12T14:18:20Z Indexed on 2010/04/12 14:23 UTC
Read the original article Hit count: 493

Filed under:
|
|

I'm not sure exactly how the code should be written but I want to test a file/folder for naming patterns, something like:

if [ -d $i ] && [ regex([0-9].,$i) {
       do something
    }

I want it to check if the file/folder is a directory and that the name of it is a number (i.e. 1 or 101 or 10007)...

© Server Fault or respective owner

Related posts about linux

Related posts about bash