From: bsh on
On Jan 20, 9:44 am, RensFunHog <pbars...(a)gmail.com> wrote:
> How can I exclude a fileName within a "for ... do" script?
> "for x in A.log B.txt NOT C.log"

"continue" and ksh extended regular expressions are mentioned
in previous posts: good! One more alternative, then: if the parameter
list of filenames is the result of a filename substitution, i.e.:

for x in *.txt *.log ...

.... then investigate the FIGNORE variable in ksh(1) and bash(1).

Make sure to set it back after that loop.

=Brian
From: Stephane CHAZELAS on
2010-01-20, 09:44(-08), RensFunHog:
> How can I exclude a fileName within a For Do script?
>
> for x in A.log B.txt NOT C.log
>
> do
> <<taskHERE>>
>
> done
[...]

The obvious portable solution with "case" has already been
given, but as shell specific solutions have already been given,
I thought I'd add a zsh one:

setopt extendedglob
for x (*.(log|txt)~*fileName*) {
<<taskHERE>>
}

The ~ globbing operator means "AND NOT" in zsh. Note that you
can add (#i) to make a pattern case insensitive and you may
append (.) to the pattern above so that it only matches regular
files. Also note that that short form of for loop above is zsh
specific.

--
St�phane