Tugger the SLUGger!SLUG Mailing List Archives

[SLUG] Re: ask help(shell-writing)


At Wed, 19 Jun 2002 18:51:20 +0800, henry wrote:
> I need to tag *.c *.h *.cpp, but it (as follows) fail
>   find . -name  ( "*.[c|h]" -or "*.cpp" )  | xargs etags

you're confusing regex and shell globbing expressions - and find(1)'s
distributive properties.


> I get a file-list to tag , but I dont know how to feed it to etags ?

 rm TAGS
 find . \( -name '*.{c,h}' -o -name '*.cpp' \) -print | xargs etags -a


for a long enough list, xargs may run etags more than once. hence the
need for "etags -a" (and the "rm TAGS" first).


NB: if you're using automake-generated Makefiles, there's already a
"make TAGS" target (that's more sophisticated than the above too).
if you have a large code tree, it's probably worthwhile looking at the
make rules it uses.

-- 
 - Gus