When I attempt to run the bash one liner to enable Bash completion, I get a permission denied message.
```$ poetry completions bash > /etc/bash_completion.d/poetry.bash-completion
bash: /etc/bash_completion.d/poetry.bash-completion: Permission denied
I also attempted this with `sudo` (I know I shouldn't...)
$ sudo poetry completions bash > /etc/bash_completion.d/poetry.bash-completion
bash: /etc/bash_completion.d/poetry.bash-completion: Permission denied
```
Other than this, poetry seems to be working fine.
The way you do it, the process that tries to write the file does not have root permissions.
You can use tee. Try:
poetry completions bash > sudo tee /etc/bash_completion.d/poetry.bash-completion
box@dev1:~$ poetry completions bash > sudo tee /etc/bash_completion.d/poetry.bash-completion
/home/box/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
[TooManyArguments]
Too many arguments.
completions [--alias ALIAS] [--] [<shell>]
I got this same issue on a fresh Ubuntu 18.04 box after installing latest poetry (0.12.17) -- maybe this should be fixed in the docs?
(I ended up first piping the output to a temporary file I could write to and then copying that in place.)
+1 I get the same error on Ubuntu 16.04
The solution proposed by @pmav99 almost worked for me, but instead of redirecting the output using >, the output should be piped to sudo tee ...:
poetry completions bash | sudo tee /etc/bash_completion.d/poetry.bash-completion
instead of redirecting the output using
>, the output should be piped tosudo tee ...
This is normal, that's because man tee' actually statestee - read from standard input and write to standard output and files...
Basicallyteeis a "fork", a "duplicator" to pipe the output BOTH on console, AND on a given file path;
of course redirecting the output doesn't work, sinceteedoes not get it's inputs from redirects but rather from stanard input, aka/dev/stdin, which is the default pipe (|`) output.
TL;DR:
tee works ONLY when piping (|) into it. (@pmav99 take note :wink:)
Most helpful comment
The solution proposed by @pmav99 almost worked for me, but instead of redirecting the output using
>, the output should be piped tosudo tee ...:poetry completions bash | sudo tee /etc/bash_completion.d/poetry.bash-completion