On Feb 20, 4:05 am, mattn <[email protected]> wrote: > It seems to be expanded like following. > > (cat <inputfile | grep foo >outputfile 2>&1) > grep: ): No such file or directory > > This should be: > > (cat <inputfile | grep foo >outputfile) 2>&1
The first is actually (mostly) correct, Vim doesn't expand to (cat <inputfile | grep foo >outputfile 2>&1) it expands to cmd /c (cat <inputfile | grep foo >outputfile 2>&1) As discussed, this should be: cmd /c (cat <inputfile ^| grep foo >outputfile 2>&1) which will in turn invoke: cat <inputfile | grep foo >outputfile 2>&1 in a new shell. Unfortunately, instead what happens now because we aren't escaping the |, is first a new shell invokes: cat <inputfile Which the invoking shell then pipes to: grep foo >outputfile 2>&1) We need the parentheses to avoid stripping the first and last quote if the command and argument both are quoted, and we need the escapes to fix the handling of special characters. Using parentheses instead of extra surrounding quotes as added in 7.3.443 allows us to ALWAYS escape special characters instead of complicated logic to determine when this is needed. -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
