zsh-users
 help / color / mirror / code / Atom feed
* how to get standard output used in command line editor?
@ 1995-06-29 15:55 Jose Unpingco
  0 siblings, 0 replies; 4+ messages in thread
From: Jose Unpingco @ 1995-06-29 15:55 UTC (permalink / raw)
  To: zsh-users


Hi,

Often, I run commands like

find . -name 'hey' -print

and the list of files looks like

hey1
hey2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to get standard output used in command line editor?
  1995-06-29 16:33 ` P.Stephenson
@ 1995-06-29 18:07   ` Barton E. Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Barton E. Schaefer @ 1995-06-29 18:07 UTC (permalink / raw)
  To: Zsh users list

On Jun 29,  5:33pm, P.Stephenson@swansea.ac.uk wrote:
} Subject: Re: how to get standard output used in command line editor?
}
} unpingco@ece.ucsd.edu wrote:
} > 
} > 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?
} 
} If you need an external editor, it doesn't look like fc will help

If you know in advance that you're going to want to do this, invoke
fc *first*, then run the "find" or whatever from inside your editor to
capture the output, and edit it into commands as you will.

You can even do this afterwards if you're willing to wait for the "find"
to run again.

Or you can do this:

    FINDOUT=/usr/tmp/find.$$
    find() {
	command find $* | tee $FINDOUT
    }

Then every time you run "find" the output gets captured for you, and you
can "vi $FINDOUT" or whatever to edit it into commands.

If you don't anticipate running finds that generate megabytes of output,
you can use:

    find() {
	FIND="$(command find $*)"
	echo "$FIND"
    }

Then "vared FIND" works, etc.

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@z-code.com                  Division of NCD Software Corporation
http://www.well.com/www/barts


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to get standard output used in command line editor?
  1995-06-29 15:58 Jose Unpingco
@ 1995-06-29 16:33 ` P.Stephenson
  1995-06-29 18:07   ` Barton E. Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: P.Stephenson @ 1995-06-29 16:33 UTC (permalink / raw)
  To: Zsh users list

unpingco@ece.ucsd.edu 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@swansea.ac.uk>  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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* how to get standard output used in command line editor?
@ 1995-06-29 15:58 Jose Unpingco
  1995-06-29 16:33 ` P.Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Jose Unpingco @ 1995-06-29 15:58 UTC (permalink / raw)
  To: zsh-users

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?

the only other way I can figure it is to send the find output to a file
and then source it after editing.

thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-06-29 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-06-29 15:55 how to get standard output used in command line editor? Jose Unpingco
1995-06-29 15:58 Jose Unpingco
1995-06-29 16:33 ` P.Stephenson
1995-06-29 18:07   ` Barton E. Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).