Command substitution in bash (and other shells) is a very versatile technique, and it comes in many forms:

Many questions involving command substitution are effectively duplicates. However, due to the multitude of forms that command substitution takes, it's hard to close them as such. There seems to be no canonical question which could be used to link those new questions to.

People at Electronics SE had a similar experience with questions about power supplies, so they came up with this canonical question, and now have a happy life. If you need a PSU, they won't care if it's for your Arduino, mobile phone, toy robot or laptop: you'll have to understand basic concepts if you don't want your question closed. In my opinion, command substitution merits a similar canonical question here.

So, my questions are:

  1. Do you think that duplicate questions revolving around command substitution concept are a problem, or is it just me?

  2. If you do, how about we make a canonical question about this?


1 Answer 1


It doesn't seem like much of a problem to me. I like the first answer you linked to, from Gilles; it looks already semi-canonical, though it has other info pertinent to that specific question mixed in with general data about command substitution.

Command substitution is more of a common solution than a common question; often people who ask questions which are solved by command substitution won't realize that's what they are looking for. I don't think there's an easy way to title such a canonical question in such a way that people who need to learn about it will actually find it when they go to ask their questions.

Plus, unlike, say, using a shell loop to process text, command substitution is fairly adequately covered in the bash manpage.

You must log in to answer this question.

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