Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The linux command

nc -l 8090 | (read METHOD URI PROTOCOL ; echo "method: $METHOD" ; echo "path: $URI" ; echo "prot: $PROTOCOL")

listens to port 8090 and when I type something like into my browser it prints out some infos about the HTTP-Request in the terminal. I can type something in the terminal window now which after Ctrl+C will be shown in the browser.

What I want is to pipe the output of the echo commands back to the stdin of nc, so it will be displayed in the browser. Is there any way to do this?

share|improve this question
up vote 2 down vote accepted

Named pipes are your friend!

mkfifo ncloop
nc -l 8090 < ncloop | (read METHOD URI PROTOCOL ; echo "method: $METHOD" ; echo "path: $URI" ; echo "prot: $PROTOCOL") > ncloop

(Tested in OS X 10.8.2 but should work on any Unix.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.