1

This question already has an answer here:

I have the following two invocations of a function in bash, which I'm piping to another function which captures the error output:

>&2 log_stdout | log_err

log_stdout >&2 | log_err

Is there any semantic difference between the two?

Edit: The suggested duplicate, while having an awesome community wiki, does not provide an answer to this specific question.

marked as duplicate by Stephen Kitt, Jeff Schaller, GAD3R, thrig, Gilles bash Mar 7 '17 at 23:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Regarding your edit, I reckoned “They can appear anywhere within a simple command or may follow a command.” in the suggested duplicate did answer your question. – Stephen Kitt Mar 7 '17 at 22:01
  • @StephenKitt: Yes, that just didn't seem clear enough for me at the time, but thanks for pointing it out. – JohnEye Mar 8 '17 at 12:52
3

They are equivalent.

The relative order of redirections may matter, but their position with respect to the command does not.

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