0

I need to check where is the signal of end-of-file in a file in Unix, and set it not to be sent to the pipe file.

I need this because I need to send a list of files using a cat and when it reaches the eof on the first file, it is sent to the pipe and it gets closed. Thus, the process stops.

Can someone help on this issue?

Thanks in advance.

EDIT code:

mkfifo file.pipe cat file1.txt file2.txt > mkfifo.pipe 

after sending the content of file1.txt it sends the EOF and closes the pipe file. Thus file2.txt is not sent.

bpgergo
  • 15,669
  • 5
  • 44
  • 68
Lucas Rezende
  • 2,516
  • 8
  • 25
  • 34

1 Answers1

0
  1. This seems to be working fine for me on Linux:

    $ mkfifo fifo
    $ yes aaa | head -n 1000 > a
    $ yes bbb | head -n 1000 > b
    $ cat fifo > result &
    $ cat a b > fifo
    $ wc result
    2000 2000 8000 result
    

    I really think that you should show us your actual code from both ends of the named pipe. You should also tell us more about your environment. "Unix" is not really helpful; tell us your operating system and hardware platform.

  2. There is no such thing as an "EOF character" and therefore it cannot be contained in a file in any shape or form. When the end of a file is reached, the corresponding read() system call will return 0 and that will be translated by the userspace to whatever scheme it has to report the end-of-file.

    So in this particular case cat will not send anything over the pipe except for the contents of its arguments - it just closes the pipe when it's done with its input.

thkala
  • 84,049
  • 23
  • 157
  • 201