Skip to contentSkip to conversation

Improving find commands?

cocci Markus Elfring 2 participants 4 messages Mar 19, 2025

lore
Share & tools
lore
#0 lore raw

Hello,

I noticed also the contribution “fix the broken command line arguments for find command” (by MA Xutong from 2025-03-12).
https://gitlab.inria.fr/coccinelle/coccinelle/-/commit/67d1b7c071a65f154f94c1193ab2d14f8d1bd3bc

How do you think about to enclose file filters by single quotation characters (instead of double quotes)?
https://unix.stackexchange.com/questions/170179/whats-the-difference-between-using-single-quotes-or-not-in-find-command

Regards,
Markus

#2 lore raw
Quoted 5 lines
Quoted 3 lines

How do you think about to enclose file filters by single quotation characters (instead of double quotes)?
https://unix.stackexchange.com/questions/170179/whats-the-difference-between-using-single-quotes-or-not-in-find-command

What would be the point of using single quotes? I also don't think you understand what's being said in that link.

I imagine that existing knowledge can be better reused also for affected command constructions (in referenced OCaml source code).
https://gitlab.inria.fr/coccinelle/coccinelle/-/commit/67d1b7c071a65f154f94c1193ab2d14f8d1bd3bc

Regards,
Markus

#3 lore raw
In reply to Victor Gambier
Quoted 1 line

What would be the point of using single quotes?

Can OCaml source code (like the following) be more appropriate?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/67d1b7c071a65f154f94c1193ab2d14f8d1bd3bc/parsing_c/test_parsing_c.ml#L35-45

…

      then
        "find " ^ path ^ " -type f \\( -name '*.cpp' -o -name '*.cxx' -o -name '*.cc' -o -name '*.h' -o -name '*.hpp' -o -name '*.hxx' \\) -not -name '*.in.*'"
      else
        "find " ^ path ^ " -type f \\( -name '*.cpp' -o -name '*.cxx' -o -name '*.cc' \\) -not -name '*.in.*'")

…

Would you like to avoid any duplicate code a bit more here?

Regards,
Markus