The (bash) command find . -name "documentation.html" | xargs xdg-open
finds a file and passes its path to xdg-open, but xdg-open errors out:
xdg-open: unexpected argument './distribution/docs/target/docs/html/documentation.html'
The command find . -name "documentation.html" -exec xdg-open {} +
results in the same error
Why? Is find
passing the quote character to xdg-open? I can't figure it out.
This might be caused by extra characters piped into xargs or errors (i.e. permission denied for certain dirs).
If you want to pass only one file to xargs you can try this:
or
Another solution will be while loop: