I have discovered that a multi-line echo command which should append to a file will not auto-complete when entering the filename. e.g. # echo "dev-lang/io ~*" >> /etc/po<TAB>pa<TAB>k<TAB> correctly gives # echo "dev-lang/io ~*" >> /etc/portage/package.keywords but # echo "dev-lang/io ~* > dev-lisp/lush ~*" >> /etc/po<TAB> does not auto-complete. Reproducible: Always Steps to Reproduce: 1. Type an echo command with a multi-line string, and attempt to pipe the output to an existing file... 2. Being sure to enter the filename using bash-completion. Actual Results: Tab-completion failed. Expected Results: Tab completion should have worked as it does with a single-line command. # emerge -pv bash-completion These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] app-shells/bash-completion-20050121-r10
Hi, what version of app-shells/bash are you using?
(In reply to comment #1) > Hi, what version of app-shells/bash are you using? > $ esearch bash [snip] * app-shells/bash Latest version available: 3.1_p17 Latest version installed: 3.1_p17 [snip]
Hi, This is not actually a bash-completion problem at all. I suspect it will never work that way you want it, but maybe it is a readline issue? Just a guess. @base-system: Is this even possible to fix or valid to report upstream?
wouldn't hurt to post to the bug-bash list and see what they have to say
This happens because readline does not react to the terminating quote issued in response to a PS2 prompt until the line containing it has been entered. Here is a workaround. # echo "dev-lang/io ~* > dev-lisp/lush ~*\ " >> /etc/po<TAB> The use of cat, followed by ^D to signify EOF, is likely simpler at that point. If still interested in pursuing it, the OP may issue enhancement requests at either https://savannah.gnu.org/support/?group=bash, https://lists.gnu.org/mailman/listinfo/bug-bash or by emailing Chet Ramey directly.
I bungled up the formatting of the previous command. Essentially, the workaround is to enter the terminating double quote, followed by a backslash then enter. The redirection can then be specified and completed as part of the final input line. Another way would be to position the redirection operator and completed path prior to the echo command. It doesn't have to be at the end.