5 Sep 03:06
filename pattern search in dynamically specified list of directories
From: scowles <scowles <at> ckhb.org>
Subject: filename pattern search in dynamically specified list of directories
Newsgroups: gmane.comp.shells.zsh.devel
Date: 2008-09-05 01:07:23 GMT
Expires: This article expires on 2008-09-19
Subject: filename pattern search in dynamically specified list of directories
Newsgroups: gmane.comp.shells.zsh.devel
Date: 2008-09-05 01:07:23 GMT
Expires: This article expires on 2008-09-19
i am currently using the following code to identify all files with X or
greater number of digits in the filenames. the list of directories in which
to do the recursive search is dynamically generated.
i am using zsh cvs sources pulled 22 august 2008 and built under ubuntu 7.10
on an intel platform; the displayed ZSH_VERSION is 4.3.6-dev-0.
the relevant, generalized code snippet i am using is shown here. the job
searches for dot files as well as non-dot files.
if anyone can offer suggestions for a simpler, cleaner one-liner, i'd very
much appreciate the suggestions.
-----------------
#!/usr/local/bin/zsh
# set appropriate options.
setopt GLOB
setopt EXTENDED_GLOB
setopt NONULL_GLOB
setopt nonomatch
# create the test environment.
[[ ! -d tmp ]] && { mkdir tmp ; }
[[ ! -d tmp/subdir ]] && { mkdir tmp/subdir ; }
touch tmp/a001 tmp/b002 tmp/c-no-digits
touch tmp/subdir/one0011 tmp/subdir/two-no-digits
# the command to dynamically generate the desired list of directories.
(Continue reading)
RSS Feed