Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xargs: invalid option -- 'o' when -x #72

Open
shtukas opened this issue May 8, 2018 · 2 comments
Open

xargs: invalid option -- 'o' when -x #72

shtukas opened this issue May 8, 2018 · 2 comments

Comments

@shtukas
Copy link
Contributor

shtukas commented May 8, 2018

ssm ssh -x -t security-hq,security,PROD --newest --profile security
xargs: invalid option -- 'o'
Usage: xargs [-0prtx] [--interactive] [--null] [-d|--delimiter=delim]
       [-E eof-str] [-e[eof-str]]  [--eof[=eof-str]]
       [-L max-lines] [-l[max-lines]] [--max-lines[=max-lines]]
       [-I replace-str] [-i[replace-str]] [--replace[=replace-str]]
       [-n max-args] [--max-args=max-args]
       [-s max-chars] [--max-chars=max-chars]
       [-P max-procs]  [--max-procs=max-procs] [--show-limits]
       [--verbose] [--exit] [--no-run-if-empty] [--arg-file=file]
       [--version] [--help] [command [initial-arguments]]

Report bugs to <[email protected]>.

See
https://www.gnu.org/software/findutils/manual/html_node/find_html/xargs-options.html
versus
https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/xargs.1.html

@adamnfish
Copy link
Contributor

The following establishes the session automatically, but doesn't connect connect up stdin (i.e. isn't interactive).

... | xargs -r0 sh -c "$@"

Some progress...

@adamnfish
Copy link
Contributor

Got it.

... | xargs -r sh -c 'exec "$@" < /dev/tty' SSM

So we can detect OSX / vs a GNU OS in the wrapper script and use the appropriate xargs invocation in each case.

It's too late to fix now, but if no one beats me to it I'll PR this tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants