It seems you need named pipes:
https://askubuntu.com/questions/449132/why-use-a-named-pipe-instead-of-a-file
Basically, you create a named pipe, run the process which gets input from the named pipe, and then pass whatever you want TO the named pipe for it to be processed by the process.
For example:
mkfifo /tmp/namedpipe
tail -f /tmp/namedpipe &
echo "BOO"> /tmp/namedpipe
echo "this" > /tmp/namedpipe
...
This will echo (by tail) to stdout everything that is sent to the /tmp/namedpipe.
I use tail instead of cat, because cat will exit the process when it receives EOF.
UPD. Clarification.
To pass this to your process you need to do something like this:
tail -f /tmp/namedpipe | yourprocess &
UP2. So in your case the sequence would be like this:
mkfifo /tmp/namedpipe
--- this will be the entry point through which you can send data to your process.
tail -f /tmp/namedpipe | /usr/lib/w3m/w3mimgdisplay &
-- this will then create the persistent process that you want, and will in future feed to it antyhing you send through the pipe.
echo -e '0;1;0;0;0;0;0;0;0;0;file.png\n4;\n3;' > /tmp/namedpipe
Should show you the image on the screen.
From now on, any further things that you will send to /tmp/namedpipe will be like new lines echoed to the command and should likewise appear on the screen.
persistently
do you mean to run it without any hangups?nohup
and&
.nohup
is used in conjunction with&
to run a process immune to any hangups