bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: output redirection with process substitution asynchronous?


From: Marc Herbert
Subject: Re: output redirection with process substitution asynchronous?
Date: Tue, 08 Dec 2009 09:55:43 +0000
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

DennisW wrote :
> Would you care to comment on the coproc command in Bash 4?

I wish I could, but I know nothing about it. Anyone else?


pjodrr wrote :
> But at least it became clear that the builtin process substitution is
> not the solution for me.

Wait! Maybe it is. I found a much nicer way to wait on the prefixer
process, if you can live with the "flock" dependency:

    prefix_with_date()
    {
        local somelock=$(tty)
        $@ > >(flock $somelock -c 'while read; do printf "%s: %s\n" "$(date)" 
"$REPLY"; done ')
        2>/dev/null flock $somelock :
    }

    prefix_with_date seq 10



Alternatives to flock might do; you got the idea.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]