Package: mksh
Version: 39.3.20101101-1
Severity: wishlist
Tags: upstream

Hi Thorsten,

Recently I found myself debugging a pipeline with "tee".
Unfortunately the logs grew large very quickly, so as a stopgap
measure I used a compressor.

        mkfifo backflow

        ... <backflow |
        tee >(xz -1 >log-one.xz) |
        ... |
        tee >(xz -1 >log-two.xz) |
        ... |
        tee >(xz -1 >log-three.xz) >backflow

This construct is also handy when one wants to update the current
environment downstream from some other process.

        while read -r line
        do
                ... something interesting with line ...
                accum=$(updated result)
        done < <(upstream process)

        : print result
        printf "%s\n" "$accum"

The semantics:

      <( ... )    - runs ... in a subshell in the background, with its
                    output connected to a pipe.  The "<( ... )"
                    expression evaluates to a filename that can be
                    opened to read from that pipe.

      >( ... )    - runs ... in a subshell in the background, with its
                    input connected to a pipe.  The ">( ... )"
                    evaluates to a filename that can be opened to write
                    to that pipe.

On Linux and similar OSes this is typically implemented using
/proc/fd.  A more portable implementation would use FIFOs.

What do you think?  Is it worth implementing in mksh?



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to