Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: how to get standard output used in command line editor?

unpingco@xxxxxxxxxxxx wrote:
> Hi,
> Often, I run commands like
> find . -name 'hey' -print
> and I get a list of files I'd like to apply various commands to.
> Is there a way to use fc to edit the list generated by the find command
> and then use the newly edited list as a command?

Probably the neatest way (it doesn't require any editors) is

print -z "$(find . -name 'hey' -print)"

(double quotes necessary) which sticks the output straight into the
multi-line buffer, so you can edit the list and the whole lot will be
executed when you hit return.

If you need an external editor, it doesn't look like fc will help from
reading the manual page --- it doesn't seem to interact directly
either with the line editor or even with standard input: something
like you're original thought is probably necessary.

Peter Stephenson <P.Stephenson@xxxxxxxxxxxxx>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.

Messages sorted by: Reverse Date, Date, Thread, Author