LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Write to pipe file hangs (using echo command) (https://www.linuxquestions.org/questions/linux-newbie-8/write-to-pipe-file-hangs-using-echo-command-4175542239/)

VaniJ 05-11-2015 02:10 AM

Write to pipe file hangs (using echo command)
 
HI,

I am a newbie to Linux and am trying to create a pipe file with the below command:

mkfifo pone

Now I am trying to write data to the file with the following command on the command prompt:

echo asdadsasdasdasdasdasd >./pone

But after i enter this command- the screen hangs up and doesnt proceed ahead.
Same thing happened when I tried writing using:
gedit pone


Can anyone help me resolve this issue?

pan64 05-11-2015 02:11 AM

is there any other process reading that pipe?

VaniJ 05-11-2015 02:13 AM

Quote:

Originally Posted by pan64 (Post 5360728)
is there any other process reading that pipe?

None.
I am using a virtual machine and have just opened a terminal and typed these commands.

pan64 05-11-2015 02:29 AM

in that case most probably the buffer of that fifo is full. You need to read the content by for example cat pone in another terminal.

VaniJ 05-11-2015 02:31 AM

Quote:

Originally Posted by pan64 (Post 5360735)
in that case most probably the buffer of that fifo is full. You need to read the content by for example cat pone in another terminal.

typing cat pone on the terminal also has same result.
The screen just hangs until i do a Ctrl+C

pan64 05-11-2015 02:43 AM

yes, sure, cat pone will wait for input. You need to open another terminal and write into the pipe (that is the echo command you posted)

VaniJ 05-11-2015 03:13 AM

Quote:

Originally Posted by pan64 (Post 5360740)
yes, sure, cat pone will wait for input. You need to open another terminal and write into the pipe (that is the echo command you posted)

Oh that worked perfectly well..
THough - since I am a newbie i am not sure what exactly is it that you made me do :-|
I will search online for the command 'cat' and figure that out.
Thanks a ton!

-Vani

pan64 05-11-2015 03:51 AM

you can also check the man page of cat, man page of mkfifo and https://en.wikipedia.org/wiki/FIFO_2...electronics%29 and https://en.wikipedia.org/wiki/Named_pipe (and of course you can find more useful info too)


All times are GMT -5. The time now is 12:40 PM.