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

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



On Jun 29,  5:33pm, P.Stephenson@xxxxxxxxxxxxx wrote:
} Subject: Re: how to get standard output used in command line editor?
}
} unpingco@xxxxxxxxxxxx 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@xxxxxxxxxx                  Division of NCD Software Corporation
http://www.well.com/www/barts



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