1

It's really important because intuitively they are all similar for me.

Could one realise that those two are really like one another for me, i.e. absolutely equal?

4
  • I can't say why I don't understand.
    – Xsi
    Nov 20, 2012 at 19:58
  • did you mean grep SMTH <(CMD) instead of grep SMTH $(CMD)? cause first one is really close to CMD | grep SMTH.
    – rush
    Nov 20, 2012 at 20:32
  • 4
    This is not a bad question, I would upvote it if only you please stopped spamming your own questions with so much confusion and - is it anger? Relax! You won't learn anything as all your energy will be wasted on being constantly on fire. Nov 20, 2012 at 21:47
  • sorry, you were right. xi@localhost ~ $ grep SRC_URI $(find /usr/portage -name *.ebuild) | wc -l 25921 xi@localhost ~ $ cat $(find /usr/portage -name *.ebuild) | grep SRC_URI | wc -l 25921 - no difference, except for inclusion of filename with direct grep
    – Xsi
    Nov 23, 2012 at 12:16

1 Answer 1

8

They don't do the same thing at all. The former is command substitution, the latter is piping. The result is completely different.

grep foo "$(echo foo)" will look for the word "foo" in a file called "foo", because "foo" is the output from echo. echo foo | grep foo will look for the word "foo" from its STDIN input. In the former case, you'll probably get a file not found error. In the latter case, you won't. They're fundamentally not the same operation.

14
  • It might be simply didn't fit my mind cause I used to know there are 3 working principles: STDIN STDOUT STDERR. From your perspective I couldn't use pipe with any given command that I want to use. Because I must somehow know with what command work - 3 cases, or even more - with 4th case - with file. Surely I have mess in my head. I'm very unsure that help (man page) consist of such things as arguments. Are those - arguments, or I'm bad at terminology?
    – Xsi
    Nov 20, 2012 at 20:07
  • The standard streams are not arguments, they are streams provided to the program.
    – Chris Down
    Nov 20, 2012 at 20:09
  • Next moment, now It seems that I can't use $() because it is not at least as good in description as pipe (takes something from STDIN(OUT))
    – Xsi
    Nov 20, 2012 at 20:09
  • equery -q uses equery -q files '*' bash: /usr/bin/equery: Argument list too long equery -q uses xargs equery -q files '*'
    – Xsi
    Nov 27, 2012 at 4:31
  • xargs equery -q uses equery -q files '*'
    – Xsi
    Nov 27, 2012 at 4:32

You must log in to answer this question.

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