[ale] I need a bash clue.
Joe Knapka
jknapka at kneuro.net
Thu May 13 19:31:39 EDT 2004
I could solve this with a trivial Python program, but I'd rather
understand how to make bash do it on the command line, if it can be
done.
The task is: starting at the current directory, visit every directory
in the subtree and run "etags" on every .c|.cc|.cpp|.h|.hpp file in
each directory, leaving the resulting TAGS file in the directory
containing the source files. I've tried the obvious
find . -type d -exec ( pushd {} ; etags *.c ; popd ) ;
but that fails due to syntax errors on the parens. Escaping the parens
leads to different syntax errors.
I *can* do
etags `find . ( -name "*.c" -o -name "*.cc" -o -name "*.cpp" ) -print`
But then the TAGS file gets created at the root of the tree I'm
looking at, which isn't what I want. The structure of what I want to
do is simple: visit each directory, make it current, and run a command
(which may need to use shell characters). But how to actually feed
that command to "find" is not obvious to me.
Yeah, I could read the bash man page for the Nth time, but I'm hoping
someone here can answer the question more quickly from personal
knowledge :-)
Thanks,
-- Joe
--
Resist the feed.
--
If you really want to get my attention, send mail to
jknapka .at. kneuro .dot. net.
More information about the Ale
mailing list