A few of us were discussing the fact that information on the various shell operators is spread across multiple Q&As. For example:
- Is there a difference between `;` and `&&` and `|`?
- redirection and pipeline
- Confusing use of && and || operators
- Difference between > and | with /dev/tty
- How can one run multiple programs in the background with single command?
And many others. The basic question in each case is how a particular shell operator works. So, I decided to write a canonical Q&A giving a brief explanation of what the different operators do. The idea was that we can then close the various other questions as duplicates of the canonical one:
What are the shell's control and redirection operators?
My hope was that my answer would be general enough to serve as an answer to all of the above questions and also to the future ones. That it would act as a global target against which we can close any question about how shell operators work (at least with respect to bash).
I should also point out that I had not made my answer into a community wiki post which might have given the impression that I was after the reputation points. I have now made it a CW answer, something I should have done in the first place, so that should no longer be a concern.
However, today, I closed a question as a duplicate of mine and two users felt that I was overstepping my bounds as a moderator. I am therefore bringing this up here. Should we close those other questions as a duplicate of mine or should we instead choose one of the existing ones, broaden it and I should repost my answer there? What do you think is the best way of dealing with similar cases in the future?
Relevant discussions: