Mailinglist Archive: opensuse (1264 mails)

< Previous Next >
Re: [opensuse] Quick question: how to call a script function from "find"? - using parallel
  • From: Vojtěch Zeisek <vojtech.zeisek@xxxxxxxxxxxx>
  • Date: Wed, 14 Jun 2017 14:47:53 +0200
  • Message-id: <2204417.ZWnZs2PXCW@tilia>
Dne středa 14. června 2017 14:25:59 CEST, Carlos E. R. napsal(a):
On 2017-06-14 13:53, Per Jessen wrote:
Carlos E. R. wrote:
find /home/cer/Fusion/Videos/ -type d | parallel parallel "sudo chown

one too many 'parallel's ? typo?

Oops.

Corrected, but still fails:

cer@Isengard:~/Fusion> time ./_Cambiar_permisos_Videos

To silence the citation notice: run 'parallel --bibtex'.

Run it to get rid of it. The author works at university (apparently) and he
gives money also according to how many other scientists appreciate his work by
citing it in their scientific work.

chown: cannot access '/home/cer/Fusion/Videos/Buffy,\
cazavampiros/Temporada\ 7': No such file or directory chown: cannot access
'/home/cer/Fusion/Videos/Buffy,\ cazavampiros': No such file or directory
chown: cannot access '/home/cer/Fusion/Videos/Major\ Crimes': No such file
or directory chown: cannot access '/home/cer/Fusion/Videos/Major\
Crimes/Temporada\ 5': No such file or directory ...
chown: cannot access '/home/cer/Fusion/Videos/Twin\ Peaks/Temporada\ 3': No
such file or directory /bin/bash: -c: line 0: unexpected EOF while looking
for matching `'' /bin/bash: -c: line 1: syntax error: unexpected end of
file
/bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 1: syntax error: unexpected end of file

You have mistyped some quotation (e.g. typographic quote instead of plain ").
It is not closed, BASH is confused, command fails. It can be caused by non-
standard character in the name of some directory.
Parallel prints output for particular line when everything is done (not to
overlap outputs of processing of more files). It obviously starts non-
interactive shells, so You can't get sudo prompt. If You run sudo right before
(e.g. 'sudo echo') and then parallel, it'll remember the sudo authentication
(as when You run 'sudo X' and 'sudo Y' quickly).

chown: cannot access '/home/cer/Fusion/Videos/Warehouse\ 13': No such file
or directory

#!/bin/bash

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

find /home/cer/Fusion/Videos/ -type d | parallel "sudo chown cer:cer '{}' &&
chmod u+r+w+x,g+w+x,o+r-w-x,+t '{}' && sudo chown cer-g:cer '{}' && sudo
setfacl -m u:wwwrun:rx '{}'"

See 'find /home/cer/Fusion/Videos/ -type d | parallel "echo '{}'"' - it
obviously escapes non-standard characters, but has issue with ', " and so. I
think this should be alright for the commands You use.

Changed to:

find /home/cer/Fusion/Videos/ -type d | parallel --bibtex "sudo chown
cer:cer '{}' && chmod u+r+w+x,g+w+x,o+r-w-x,+t '{}' && sudo chown cer-g:cer
'{}' && sudo setfacl -m u:wwwrun:rx '{}'"

Thousands of overflowing the display buffer:

Type: 'will cite' and press enter.

Run 'parallel --bibtex' just once.

--
Vojtěch Zeisek
https://trapa.cz/
< Previous Next >
Follow Ups