xargs -d '\n' -n 8 bash -c 'phpcs_element PSR2 "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"' -- >&2 2>/dev/null
If I run this command into Linux it will work, if I try to run in into Mac OSX will not because the OSX xargs doesn't know about xargs -d (delimiter).
xargs: illegal option -- d
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements] [-S replsize]]
[-J replstr] [-L number] [-n number [-x]] [-P maxprocs]
[-s size] [utility [argument ...]]
Xargs Version: src/usr.bin/xargs/strnsubst.c,v 1.7 2004/10/18 15:40:47
Just use -0 instead (making the NUL character the delimiter), and convert your newlines to NULs (which are what you ought to be using to separate items in a list of file names in the first place: the NUL, not the newline, is the only character that cannot exist in a filesystem path).
tr '\n' '\0' |
xargs -0 -n 8 bash -c 'phpcs_element PSR2 "${@:1:8}"' -- >&2 2>/dev/null
If you have Homebrew, you can install findutils with this command:
brew install findutils
Then, you will be able you use -d.
You just have to prepend xargs with a g (making it gxargs).
Reference: https://superuser.com/a/467284/529605
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With