What is called a Bash construct (and / or another shell?)?

What is a constructor in bash where you can take the shell of a command that outputs to stdout, so that the output itself is treated as a stream? In case I am not describing it so well, perhaps the example will work best, and this is what I usually use for it: using diff to output which does not come from the file, but from other commands, where

cmd 

certified as

 <(cmd) 

By wrapping the command this way, in the example below, I determine that there is a difference between the two commands that I run, and then I can determine that there is one exact difference. What is the design / method of wrapping a command like <(cmd)? Thanks

 [ builder@george v6.5 html]$ git status | egrep modified | awk '{print $3}' | wc -l 51 [ builder@george v6.5 html]$ git status | egrep modified | awk '{print $3}' | xargs grep -l 'Ext\.define' | wc -l 50 [ builder@george v6.5 html]$ diff <(git status | egrep modified | awk '{print $3}') <(git status | egrep modified | awk '{print $3}' | xargs grep -l 'Ext\.define') 39d38 < javascript/reports/report_initiator.js 

ADDITION A revised command that uses advice for using the git ls file should be as follows (unverified):

 diff <(git ls-files -m) <(git ls-files -m | xargs grep -l 'Ext\.define') 
+6
source share
3 answers

It is called process replacement .

+6
source

This is called Process Substitution

+6
source

This is a replacement process, as you were told. I would like to note that this also works in a different direction. Substituting the process with> (cmd) allows you to take a command that writes to a file, and instead redirect this output to another stdin command. This is very useful for inserting something into a pipeline that takes the name of the output file as an argument. You do not see this so much, because almost every standard command will write to stdout already, but I often used it with custom materials. Here is a contrived example:

 $ echo "hello world" | tee >(wc) hello world 1 2 12 
+1
source

Source: https://habr.com/ru/post/904383/


All Articles