0

I tried to use some scripts which use tail commands on Debian stretch but I got tail: error writing 'standard output': Broken pipe.

Does Debian handle tail and pipe syntax differently?

Thank you in advance,

  • 1
    You probably have the SIGPIPE signal handler set to 'ignore' in your script or in another program calling it (eg. with trap '' PIPE). Don't do that. – mosvy Nov 12 '18 at 0:47
  • I checked the code but it appears there no SIGPIPE. – user977828 Nov 12 '18 at 1:18
  • 1
    Your code, for example tail -c +${index[${contig}]} ${fasta} | awk '$0~/>/{exit}1' specifically breaks the pipe in certain situations -- just to make that clear. If you can't control the SIGPIPE handling, then you may want to rework the code so that it tests for the />/ condition before calling the pipeline. – Jeff Schaller Nov 12 '18 at 2:06
0

Your code is

tail -c +${index[${contig}]} ${fasta} |
awk '$0~/>/{exit}1' |
awk -f ${pipeline}/utils/reverse-fasta.awk -

If the first awk finds a Fasta header line (a line that starts with the character >), it will quit. When that awk command quits, there is no longer anyone reading the output of the tail command, and tail gets killed by a SIGPIPE signal.

This is probably due to an issue with your index array, or in any case some form of mismatch between the Fasta file that you are reading from and where in the file you expect to find sequence data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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