[ale] I need a bash clue.
James P. Kinney III
jkinney at localnetsolutions.com
Thu May 13 19:46:47 EDT 2004
for i in `find . -type d` ;do cd $i; etags *.c; cd -; done
On Thu, 2004-05-13 at 18:30, Joe Knapka wrote:
> 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
--
James P. Kinney III \Changing the mobile computing world/
CEO & Director of Engineering \ one Linux user /
Local Net Solutions,LLC \ at a time. /
770-493-8244 \.___________________________./
http://www.localnetsolutions.com
GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
More information about the Ale
mailing list