How to exit from find -exec if it fails on one of the files

后端 未结 5 646
花落未央
花落未央 2021-01-17 08:29

I want to run the command

find some/path -exec program \\{} \\; 

but I want the find command to quit as soon as the command



        
5条回答
  •  悲哀的现实
    2021-01-17 09:02

    In addition to the other fine answers, GNU find (at least) has a -quit predicate:

    find path -other -predicates \( -exec cmd {} \; -o -quit \)
    

    The -quit predicate is certainly non-standard and does not exist in BSD find.

提交回复
热议问题