0

What's difference between `which port` and $(which port)

Thanks!

Charles Lu
  • 491
  • 2
  • 10
  • [Nothing](http://www.gnu.org/software/bash/manual/bashref.html#Command-Substitution). The backtick version is older, easier to miss, and doesn't nest though. – Etan Reisner Feb 24 '15 at 16:44
  • @EtanReisner Personally, I consider the "doesn't nest" thing to be a significant enough difference to invalidate the assertion that "nothing" is different... But it's probably the only thing that's significantly different, given a reasonable definition of "significant"... – twalberg Feb 24 '15 at 18:59
  • @twalberg Quoting is also saner with `$()` which I think it actually more significant but neither of those is material to the purpose which was, to my mind, the thrust of the question. That is to say someone asking this question likely isn't looking for the finer details at this point. – Etan Reisner Feb 24 '15 at 19:06
  • @EtanReisner Thanks. Is there a good example that explains the situation when nest is useful? – Charles Lu Feb 25 '15 at 20:53
  • I could contrive examples offhand but anytime you have two commands to run where one depends on the output of the other and don't want an intermediate variable. – Etan Reisner Feb 25 '15 at 20:59

0 Answers0