help-bash
[Top][All Lists]
Advanced

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

Re: How to force delay in command execution in unamed pipe?


From: Dennis Williamson
Subject: Re: How to force delay in command execution in unamed pipe?
Date: Mon, 4 Apr 2022 10:39:28 -0500

On Mon, Apr 4, 2022, 10:09 AM Jesse Hathaway <jesse@mbuki-mvuki.org> wrote:

> On Sun, Apr 3, 2022 at 12:11 AM Peng Yu <pengyu.ut@gmail.com> wrote:
> > cmd <(cmd1) <(cmd2)
> >
> > For a command like the above, I will need to let cmd2 run after cmd1
> > finishes. Of course, one could use temp files like the following. But
> > is there a way to follow such a constraint with unnamed pipes?
>
> Peng, could you use a named pipe to synchronize?
>
> e.g.
>
> #!/bin/bash
>
> sync_fifo='/tmp/sync_fifo'
> mkfifo "$sync_fifo"
> cat <(
>     date +1-%s
>     sleep 1
>     echo COMPLETE >>"$sync_fifo"
> ) <(
>     read -r _ <"$sync_fifo"
>     date +2-%s
> )
>
> rm "$sync_fifo"
>


mktemp or tempile are better than hardcoding a filename.

>


reply via email to

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