Replacement of -d in xargs for MacOS

As we all know -d will not work in macOS.

Also, placeholder % will not work in macOS.

Look at the following command which uses xargs in Ubuntu

wp term generate category --format=ids --count=3 | xargs -d ' ' -I % wp term meta add % foo bar

The above command will give the following error if you execute in macOS

So in order to execute the above command in macOS, you could do the following:

wp term generate category --format=ids --count=3 | xargs -n1 -I {} wp term meta add {} foo bar

That’s it guys and girls!

Related Articles