Bob van Luijt Bob van Luijt - 2 months ago 18
Linux Question

Running Hunspell in all subdirectories

I want to run Hunspell in all subdirectories and check all the markdown files in there.

Easy right?

So I wrote:

find ./ -type f -exec hunspell -l *.md {} \;


When I run this command it shows much more than only the three test markdown files. What is wrong with this command?

PS:

-l
means that Hunspell will only output the words that have a spelling error.

Answer

You could look for only the *.md files,

find . -iname '*.md' -type f -exec hunspell -l {} \;

Since you are not looking for a certain file name pattern, passing {} like that to hunspell means every file.

Update: added the quotes to the initial answer