Closed alexAubin closed 1 year ago
cf for example https://forum.yunohost.org/t/cant-restore-nextcloud/25083/2
The datadir did not contain any file, hence find $datadir -type f | xargs -0 chmod 0640 failed because no args was provided to chmod ...
find $datadir -type f | xargs -0 chmod 0640
There is a -r option for xargs such that it doesn't run the command at all if there's no input. cf https://unix.stackexchange.com/questions/83709/xargs-r0-vs-xargs-0
-r
xargs
For example:
mkdir foobar find foobar -type f | xargs -0 chmod 0640 # will fail (no arg for chmod) find foobar -type f | xargs -r0 chmod 0640 # will succeed (chmod aint run at all)
Problem
cf for example https://forum.yunohost.org/t/cant-restore-nextcloud/25083/2
The datadir did not contain any file, hence
find $datadir -type f | xargs -0 chmod 0640
failed because no args was provided to chmod ...Solution
There is a
-r
option forxargs
such that it doesn't run the command at all if there's no input. cf https://unix.stackexchange.com/questions/83709/xargs-r0-vs-xargs-0For example: