[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to force delay in command execution in unamed pipe?
From: |
Jesse Hathaway |
Subject: |
Re: How to force delay in command execution in unamed pipe? |
Date: |
Mon, 4 Apr 2022 10:08:24 -0500 |
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"