4

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
4

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:

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.