4 ms·
In that case, here's a very generic method for reading a specific number of lines: $ mkfifo /tmp/pipename $ (echo "C"; echo "D") >/tmp/pipename & $
by zacharyvoase 16y ago
In that case, here's a very generic method for reading a specific number of lines:
$ mkfifo /tmp/pipename
$ (echo "C"; echo "D") >/tmp/pipename &
$ { read A; read B } </tmp/pipename
$ echo "$A"
C
$ echo "B"
D
$ rm /tmp/pipename
Using named pipes does introduce the issue of cleaning them up afterwards, but if you're managing this yourself you can do that manually. I'm still investigating fun alternative solutions to this problem.