I have this command inside a Bash shell script, the intention of which is to apply a java command, htmlcompressor, to each HTML file found in a directory:find $DIR -type f -name '*.html' -exec java -jar $BASEDIR/Upload/htmlcompressor-1.5.3.jar --remove-intertag-spaces {} \;However, while the output at the command line seems to indicate that it is finding each file and doing something with it, it's not actually writing the results to the files.According to the documentation for htmlcompressor, the usage is this:Usage: java -jar htmlcompressor.jar [options] [input]So there's supposed to be an input file at the named at the end, but I thought the find command took care of that. Seems I'm wrong about that, though.What can I do to make it actually act on the files I find?
How can I get this java command to act on each file found by a find command?
bash;find;java
What you've provided seems to be correct; you can verify that java is being invoked correctly by inserting echo into the command:find $DIR -type f -name '*.html' -exec echo java -jar $BASEDIR/Upload/htmlcompressor-1.5.3.jar --remove-intertag-spaces {} \;(assuming a properly POSIX compliant system which has non-builtin versions of shell builtins on the standard PATH).Beyond that, you might want to run one of the resulting commands manually to verify that it is working correctly.