when you background a process its standard input will be set to /dev/null
#!/bin/bash -x
mkfifo pipe 2>/dev/null
cat - | tee pipe >/dev/null &
cat pipe
So you need to specify you want the stdin
of the parent, in your case the pipe between echo
and ./test.sh