Re: [dev] [sbase] find and xargs different results than busybox

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Tue, 17 Jul 2018 07:05:43 -0700

On Sun, Jul 15, 2018 at 12:41 PM andremw <andremw_AT_protonmail.com> wrote:
> -find /home/user -type d -print0 | xargs -0 chmod 0775
> -find /home/user -type f -print0 | xargs -0 chmod 0664
>
> In busybox they work, in sbase they return-
> -find: paths must precede expression: -print0
> -usage: xargs [-rtx] [-E eofstr] [-n num] [-s num] [cmd [arg ...]]

find -print0 is not specified by POSIX. If you want to print nul
separated data use:

find ... -exec printf %s\\0 {} +

But that's normally useless as xargs -0 is also not specified by
POSIX. The solution is to just use find's -exec. The two commands
would be:

find /home/user -type -d -exec chmod 0775 {} +
find /home/user -type f -exec chmod 0664 {} +
Received on Tue Jul 17 2018 - 16:05:43 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 17 2018 - 16:12:07 CEST