Skip to main content
Post Closed as "Duplicate" by Inian, vonbrand, G-Man Says 'Reinstate Monica', muru, Fabby
edited tags
Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

This works

find ./ -iname '*.c' -o -name '*.h' -o -name '*.l' -exec grep -irn test1 {} \;

If I combine -exec-exec with ls then it tells me that is improper option.

#ls -exec touch {} \;
ls: invalid option -- 'e'
Try 'ls --help' for more information.

Is my understanding correct that -exec-exec option is used only by find and not by other commands?

This works

find ./ -iname '*.c' -o -name '*.h' -o -name '*.l' -exec grep -irn test1 {} \;

If I combine -exec with ls then it tells me that is improper option.

#ls -exec touch {} \;
ls: invalid option -- 'e'
Try 'ls --help' for more information.

Is my understanding correct that -exec option is used only by find and not by other commands?

This works

find ./ -iname '*.c' -o -name '*.h' -o -name '*.l' -exec grep -irn test1 {} \;

If I combine -exec with ls then it tells me that is improper option.

#ls -exec touch {} \;
ls: invalid option -- 'e'
Try 'ls --help' for more information.

Is my understanding correct that -exec option is used only by find and not by other commands?

Source Link
kurramkurram D
  • 519
  • 1
  • 4
  • 11

Understand -exec command?

This works

find ./ -iname '*.c' -o -name '*.h' -o -name '*.l' -exec grep -irn test1 {} \;

If I combine -exec with ls then it tells me that is improper option.

#ls -exec touch {} \;
ls: invalid option -- 'e'
Try 'ls --help' for more information.

Is my understanding correct that -exec option is used only by find and not by other commands?