I was trying to execute this command to fix yet another error (Unable to use a TTY - input is not a terminal or the right kind of file):
kubectl get pods -n foobar | grep baz | awk '{print $1}' | xargs -J % kubectl exec -it -n foobar % /bin/bash
Which resulted in the following error:
xargs: invalid option -- 'o'
I was able to execute the command correctly on my Mac Mojave, but not on Ubuntu 16.04.
According to the xargs website, there should have been a -o option:
--open-tty
-o
Reopen stdin as /dev/tty in the child process before executing the command, thus allowing that command to be associated to the terminal while xargs reads from a different stream, e.g. from a pipe. This is useful if you want xargs to run an interactive application.
grep -lz PATTERN * | xargs -0o vi
But man xargs
did not show this option.
The changelog did not mention any change to the flag.
My xargs version on Ubuntu 16.04 LTS:
xargs (GNU findutils) 4.7.0-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Eric B. Decker, James Youngman, and Kevin Dalley.