Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am in a similar situation as in this post But I couln't get the solution provided there to work in my situation as the answer seems related to that question only.

In particular, I couldnt understand what was the purpose of

cat my.fifo | nc remotehost.tld 10000

In my case, I have a process running and waiting for input. how can I send input to that process using named pipes?

I've tried echo 'h' > /proc/PID/fd/0 it just displays 'h' on the process' window.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Just ignore the lines containing nc, the OP in this questions wants to use it to transfer data over the network via nc.

That leaves you with:

mkfifo yourfifo
cat > yourfifo &
mypid=$!
yourprogram < yourfifo

Now you can sent data to your program with

echo "Hello World" > yourfifo

If you are done, terminate your program, issue the command kill $mypid to get rid of the dummy process to keep the FIFO open and rm yourfifo to get rid of the named pipe.

share|improve this answer
    
Sorry, but I must be missing something. When I do it this way. I am getting following output [6]+ Stopped cat > myfifo for any command I run after cat > myfifo & –  aditya Oct 29 '12 at 10:17
    
Thanks mate! Got it working with other process. Solution was perfect. –  aditya Oct 29 '12 at 12:05
add comment

Your Answer

 
discard

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.