The code for my website uses this piece of code for automatic deployment on the server (Ubuntu).
cmd = \'cd \' + checkout_dir + \' && \' +
The -r
for xargs
isn't working on OS X, since it's a GNU extension. As for workaround, you should specify some dummy file which can be parsed by xargs
or to not call command when there are no arguments (which can be checked before).
Method using temporary file (or any other placeholder):
some_cmd ... | xargs svn revert $(mktemp)
Using condition in shell:
files=$(cd checkout_dir && ... | tac)
if [ -n "$files" ]; then
echo $files | xargs && ...
fi
See also: Ignore empty result for xargs