Peng Yu
2018-02-11 23:28:05 UTC
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"
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
Regards,
Peng