If I run a command like
grep -rl test . | xargs vim
I get a warning "Vim: Warning: Input is not from a terminal." But I am still able to edit the files. Why the warning?
Because Vim is invoked from inside the pipeline, the
Better avoid the pipe, e.g. via
or from inside Vim:
Vim needs its standard input to be the terminal where you'll enter commands, but it gets either
You can restore standard input through an intermediate shell.
If the file names don't contain any whitespace character or any of
One way to cope with special characters (other than newline) is to restrict word splitting to newlines and turn off globbing.
If you use GNU Parallel instead of xargs you do not get the warning and your terminal settings are not changed afterwards:
Added bonus: It works even if filenames contain space, ' or ".