Skip to main content
1 of 4
pnom
  • 297
  • 1
  • 3
  • 8

Evaluation of find ( -exec )

I'm searchin for all files that contains one of those strings If they do i change their access rights.

 find . -type f -exec grep -q '#!/bin/bash\|#!/usr/bin/grep\|#!/usr/bin/awk' {} \; -exec chmod 700 {} ;\

I'm curious how the find works when it finds a file containing that string grep -q gives me 0 so another exec executes but should not that second exec find all files and change the rights to all files ? Why does it works and change it only to files containing that string.

pnom
  • 297
  • 1
  • 3
  • 8