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

Always save first N bytes of output from all commands?



Hi,

Is there an easy easy way to *always* save the (first N bytes) of the
output all commands? Or least save the output of the very last command?

Something like always having

 | tee ~/.output_history/$TTY/${HISTCMD}.out

but ideally with a control over the number of bytes written. Is something
like that possible?

Right now I resort to insert-last-command-output function (original by pws
at http://www.zsh.org/mla/users/2005/msg00550.html while answering a
question of mine...). To re-execute a command and insert its output in the
command line. Sometimes it is fast enough and sometimes it is slow. I know
we have "keep" (./share/zsh/functions/keeper) distributed with Zsh itself,
but keep much like tee has to be manually inserted into the command itself
and that it becomes less awesome.

I work on OSX and I bet I can write AppleScript code to... somehow fetch
the output and insert in the buffer but it I'd rather a (portable)
Zsh-based solution.

Any ideas other than going the AppleScript route?
-- 
Francisco


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