[Ilugc] .a-tip-a-day. xargs command
- From: rmathews@xxxxxxxxx (Roshan Mathews)
- Date: Tue Sep 22 08:20:56 2009
On Mon, Sep 21, 2009 at 5:44 PM, Roshan Mathews <rmathews@xxxxxxxxx> wrote:
On Mon, Sep 21, 2009 at 4:39 PM, Kapil Hari Paranjape <kapil@xxxxxxxxxxx>
wrote:
Perhaps you should try it and then make a pronouncement!
My bad, but I only have access to Cygwin and I tried `xargs ls' ...
anyways this seems interesting, will check at work tomorrow.
This is interesting.
$ find -name "*.h" | xargs nano
Received SIGHUP or SIGTERM
<doesn't screw up anything, doesn't start>
$ find -name "*.h" | xargs emacs
<opens emacs with the files, everything ok>
$ find -name "*.h" | xargs emacs -nw
emacs: standard input is not a tty
<doesn't screw up anything, doesn't start>
$ find -name "*.h" | xargs gvim
104 files to edit
<works, exits, everything ok>
$ find -name "*.h" | xargs vi
Vim: Warning: Input is not from a terminal
104 files to edit
<exit to find shell has gone to sleep>
The issue does seem to be, as Kapil Paranjape pointed out,
that vi has it's stdin set to /dev/null which it doesn't like.
http://sial.org/howto/shell/ suggests that you can use
backticks (instead of xargs) like so:
$ vi `find -name "*.h"`
Or, just use emacs.
Roshan
Other related posts: