[ale] I need a bash clue.
Joe Knapka
jknapka at kneuro.net
Thu May 13 23:33:41 EDT 2004
Fletch <fletch at phydeaux.org> writes:
> >>>>> "Joe" == Joe Knapka <jknapka at kneuro.net> writes:
>
> [...]
>
> Joe> find . -type d -exec ( pushd {} ; etags *.c ; popd ) ;
>
> Not that the for solution also wouldn't work,
It actually did work. I'm happily etagging away.
> but you can also run the
> commands inside in a subshell where changes to things such as cwd
> don't affect the parent shell.
>
>
> find . -type d -exec bash -c '( cd '{}'; etags *.c )' \;
That was what I was looking for. The interaction between find's
command-line parsing and the shell's parsing and expansion is somewhat
confusing.
>
> Or just use zsh and dispense with the find altogether (this also
> checks that there are .c files in the directory before trying to run
> etags).
>
>
> for i in **/*(/); do (cd $i; [[ -n "$(print *.c(N))" ]] &&etags *.c) ; done
Looks interesting, though no less opaque than the bash version.
I'll read up on zsh.
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