Bash: outputting a pipe to a background process?
I would like to put a process in the background and then pass data to it multiple times. For example:
cat & # The command I want to write into
cat_pid=$! # Getting the process id of the cat process
echo hello | $cat_pid # This line won't work, but shows what I want to
# do: write into the stdin of the cat process
So I have a PID, how can I write to this process? I would be open to starting the cat process in a different way.
Also, I am on a Mac so I cannot use /proc
:(
+3
source to share
2 answers