On Sat, Mar 13, 2021 at 01:05:32AM +0100, Alex fxmbsw7 Ratchev wrote:
> i have no example to write here as this was past long
Without sample, i'ts hard to represent your case!
> the story was, i was coding a file server daemon, with socat,
Wow!
> and i figured to use exec why not more exact more efficient
Something like:
-- In any terminal (first)
$ coproc socat TCP4-LISTEN:3333 STDIO
$ while read -u $COPROC foo;do echo $foo; echo $RANDOM >&${COPROC[1]};done
-- In another terminal
$ exec {netconn}<>/dev/tcp/localhost/3333
$ echo >&$netconn foo ; read -u $netconn foo ; echo $foo
24522
$ echo >&$netconn bar ; read -u $netconn foo ; echo $foo
29969
(while you will see in first terminal:
foo
bar
)
> but using it resulted sometimes output of code of the script in the output
> of the files
> removing exec made it work normally as supposed
Or are did you mean `EXEC` <address> of `socat`?
-- Don't run this if you don't understand what you do!
socat TCP4-LISTEN:3333 EXEC:/bin/bash
??
--
Félix