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

How to obtain a simple use-case: redirect filtered data into file, unfiltered to the terminal?

I have a simple use-case that I would want to implement:
1. There is an application that outputs colorized logs.
2. I want the logs to go into a file (say `operation.log') filtered,
i.e. without colors.
3. But at the same time still go to the terminal unfiltered.
4. I want the application to have a positive response from the
iatty(1) function, i.e. that the application is thinking that the
output is to the terminal (well, it really *is*, it's just that it.
*also* goes to the file).

So writing one sentence: a terminal application outputting logs
filtered-and-redirected into a file, preserving the connection and
output to the terminal, i.e. isatty(1) answers positively for the app.

I tried with multios:

scrapy crawl 2nd_MyDom "$@" "${optarray[@]}" \
    > >(ansifilter >>! "scrapy.slog") 1> >/dev/tty

But this solution doesn't realize the 4th item – it doesn't provide
isatty(1) positive response for the app.

Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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