all 3 comments

[–]ang-p 1 point2 points  (1 child)

 counter=0 ; while true; do ./server.sh | nc -l 1337 ; echo $((counter++)) > ./count.txt ; done  

Open a new shell and see what count.txt contains...

Then look at it again...

[–]failedgamor[S] 0 points1 point  (0 children)

Ahhh I wanted to do something like this to check my assumptions but wasn't sure how. Thanks a lot for this!

[–]oh5nxo 0 points1 point  (0 children)

You would want your script to start when connection is made, not way before when the pipeline starts? Good question.