help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] How to not terminate a process using pipe?


From: Pierre Gaston
Subject: Re: [Help-bash] How to not terminate a process using pipe?
Date: Mon, 12 Feb 2018 08:31:38 +0200

On Mon, Feb 12, 2018 at 1:28 AM, Peng Yu <address@hidden> wrote:

> Hi,
>
> In the following example, `cat` will be terminated when the first echo
> runs. Is there a way to make `cat` persistent so that it can still
> receive the input from the second echo?
>
> $ cat main.sh
> #!/usr/bin/env bash
> # vim: set noexpandtab tabstop=2:
>
> set -v
> mkfifo in out
> cat < in > out &
>
> echo x > in
> read -r x < out
> echo "$x"
>
> echo y > in
> read -r x < out
> echo "$x"
>
> --
> Regards,
> Peng
>
>
I believe you will find several alternatives there:
http://mywiki.wooledge.org/BashFAQ/085


reply via email to

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