Mailinglist Archive: opensuse (1264 mails)

< Previous Next >
Re: [opensuse] Quick question: how to call a script function from "find"?
  • From: Per Jessen <per@xxxxxxxxxxxx>
  • Date: Tue, 13 Jun 2017 09:19:25 +0200
  • Message-id: <oho3lt$foh$>
Carlos E. R. wrote:

The intention was to convert:

find /home/cer/Fusion/Videos/ -type d -exec sudo chown cer:cer '{}' \;
find /home/cer/Fusion/Videos/ -type d -exec chmod
u+r+w+x,g+w+x,o+r-w-x,+t '{}' \;
find /home/cer/Fusion/Videos/ -type d -exec sudo chown cer-g:cer '{}'
#setfacl -m u:wwwrun:rx  /data/waterhoard/

to a single "find". And calling a function in the same script seemed
to me the clearest way of doing it.

I usually tend towards 'xargs' because it can be parallelised, but in
this case, I would probably do this:

find /home/cer/Fusion/Videos/ -type d |\
while read d;
sudo chown cer:cer $d
chmod u+r+w+x,g+w+x,o+r-w-x,+t $d
sudo chown cer-g:cer $d

Per Jessen, Zürich (21.4°C) - free dynamic DNS, made in Switzerland.

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >