Globbing

Rahul Siddharthan rsidd120 at gmail.com
Thu Feb 14 03:36:16 PST 2008


"Simon 'corecode' Schubert" wrote:
>likewise, with find for subdirs (not POSIX):
>
>find . -name '*.el" -exec sh -c 'for f; do [ -f "${f}c" ] || echo  "$f"; done' dummy {} +

which gives me
bash: syntax error near unexpected token `do'

The reason is a mismatched quote pair around *.el, which I only
realised when cut-and-pasting your command into emacs with syntax
highlighting enabled.  I'm impressed that you sent it without trying
it first, and got it right except for a trivial typo.  But for the
rest of us, doing non-trivial things with the shell is often not worth
the effort.

For me already python is faster, and not just in terms of thinking
things through. For example, I tried creating 100,000 files and
removing them with the "rm" function that you suggested a few emails
ago.  It did the job but took a good long time, and this is a fairly
fast opteron workstation.  In that time, I could have written a python
program to parse a list of files and remove each one....

A more powerful shell is badly needed.  (I believe zsh and others are
vast improvements on bash, I should check them out.) Of course, not a
topic for kernel at ...

Rahul





More information about the Kernel mailing list