help-bash
[Top][All Lists]
Advanced

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

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


From: Peng Yu
Subject: [Help-bash] How to not terminate a process using pipe?
Date: Sun, 11 Feb 2018 17:28:05 -0600

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



reply via email to

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