Skip to main content
1 of 5
Sergiy Kolodyazhnyy
  • 16.9k
  • 12
  • 58
  • 111

The pipe and redirection are different animals, so to speak. When you use here-doc redirection ( << ) or redirecting stdin < the text doesn't come in out of thin air - it actually goes into a file descriptor ( or temporary file, if you will ), and that is where the binary's stdin will be pointing.

Specifically, here's an example from bash's source code, redir.c file (version 4.3):

/* Create a temporary file holding the text of the here document pointed to by REDIRECTEE, and return a file descriptor open for reading to the temp file. Return -1 on any error, and make sure errno is set appropriately. */ static int here_document_to_fd (redirectee, ri) 

So since redirection can basically be treated as files, the binaries can navigate them , or seek() through the file easily, jumping to any byte of the file. Pipes , since they are sequential stream of chunks of 4096 bytes (at least on Linux, if I remember that number correctly) , they aren't seekable. I once implemented tail command in python. 29 million lines of text can be seeked in microseconds if redirected, but if cat'ed via pipe , well, there's nothing that can be done - so it all has to be read sequentially.

Your specific binary, since we don't know what it is, probably attempts seeking, but cannot seek pipes. It is recommended you consult its documentation to find out what exactly errror code 14 means.

Sergiy Kolodyazhnyy
  • 16.9k
  • 12
  • 58
  • 111