On 2/21/17 8:18 AM, Florian Mayer wrote:
> The following code assumes the lock to be in state not-taken before the
> snippet runs.
>
> echo foo | tee \
> >(mutex --lock; echo before; cat; echo after; mutex --unlock) \
> >(mutex --lock; echo foobar; mutex --unlock) \
> > /dev/null | ca
On Tue, Feb 21, 2017 at 03:11:22PM +0100, Florian Mayer wrote:
> >What does it do?
> It behaves like the p-operation on unary Sys-V semaphores.
OK, without digging any further into this morass, and without trying
to guess whether you've found a bug in bash or in your own tool, can I
just leave thi
On Tue, Feb 21, 2017 at 3:18 PM, Florian Mayer wrote:
> The following code assumes the lock to be in state not-taken before the
> snippet runs.
>
> echo foo | tee \
> >(mutex --lock; echo before; cat; echo after; mutex --unlock) \
> >(mutex --lock; echo foobar; mutex --unlock) \
> >
What does it do?
It behaves like the p-operation on unary Sys-V semaphores. If the semaphore has
not been taken (has had the value 1), mutex --lock immediately exits. If the
semaphore has indeed been taken already (has the value 0), mutex --lock will
try to gain the lock and only exit if it wa
On Tue, Feb 21, 2017 at 4:00 PM, Pierre Gaston
wrote:
>
>
> On Tue, Feb 21, 2017 at 3:18 PM, Florian Mayer
> wrote:
>
>> The following code assumes the lock to be in state not-taken before the
>> snippet runs.
>>
>> echo foo | tee \
>> >(mutex --lock; echo before; cat; echo after; mutex --u
On Tue, Feb 21, 2017 at 02:18:03PM +0100, Florian Mayer wrote:
> for mutex --lock I use a tool which I wrote myself.
What does it do?
> The following code assumes the lock to be in state not-taken before the
> snippet runs.
What lock?
> echo foo | tee \
> >(mutex --lock; echo before; cat;
The following code assumes the lock to be in state not-taken before the
snippet runs.
echo foo | tee \
>(mutex --lock; echo before; cat; echo after; mutex --unlock) \
>(mutex --lock; echo foobar; mutex --unlock) \
> /dev/null | cat
for mutex --lock I use a tool which I wrote myself
On Mon, Feb 20, 2017 at 11:25:22PM +0100, Florian Mayer wrote:
> echo foo | tee >(echo $$) >(echo $$) >/dev/null | cat
>
> returns the same PID twice.
$$ is the PID of the main shell. I think what you want is the PID of
each subshell, $BASHPID.
imadev:~$ cat <(echo $$) <(echo $$)
3751
3751
imad
echo foo | tee >(echo $$) >(echo $$) >/dev/null | cat
returns the same PID twice. I'm using the version 4.4.11.
Why is there only one process for all the expansions?
Why wasn't that documented?
I think the only right way to do multiple process expansions in one command
is by actually _starting o