Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: executing commands in directories containing specific files



Leonardo Barbosa sent me the following 0.3K:

> I'd like to find TeX files (find $HOME -type f -name '*.tex'). Let's say i
> have found files a.tex, b.tex, and c.tex. Now, i wanna remove a.aux, b.aux,
> c.aux. What's the best way of doing that?

There's probably a way to combine the glob and the expansion that I don't know about, but you could do this:

  texs=(*.tex) && rm ${^texs:r}.aux

${texs:r} strips off the extension giving the Root name of each element in texs. The ${...}.aux causes the .aux to be appended, and the ${^...} causes the appending to happen element-wise.

-- 
Chris Johnson
johnch@xxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author