5

I know the difference between > and >> when redirecting to a plain file. But is there a difference when redirecting to a named pipe (fifo)?

Assume the namedpipe is a named pipe. Are the following bash command equivalent?

echo something > namedpipe
echo something >> namedpipe

1 Answer 1

7

From bash's point of view, the two produce the same effect.

Either one will successfully write to the pipe if you have something reading from it, and since the pipe is a special device (rather than a file), its length will not change (as a regular file would, if you used the >> append operator). The pipe does not remember what you have written to it, after forwarding the data to the reader, so > and >> look the same.

Further reading:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .