Diff Two Command Outputs: Difference between revisions

From Leo's Notes
This page was last edited on 29 April 2013, at 08:09.
Created page with "To run <code>diff</code> on two command outputs, such as two <code>ls</code>'s, run: diff <(cd directory1; ls) <(cd directory2; ls) This is assuming you are using bash, or ..."
 
mNo edit summary
Line 1: Line 1:
To run <code>diff</code> on two command outputs, such as two <code>ls</code>'s, run:
To run <code>diff</code> on two command outputs, such as two <code>ls</code>'s, run:
 
<syntaxhighlight lang="bash" line start="1" enclose="div">
  diff <(cd directory1; ls) <(cd directory2; ls)
  diff <(cd directory1; ls) <(cd directory2; ls)
 
</syntaxhighlight>
This is assuming you are using bash, or a shell that can handle sub shells and pipes similar to bash.  
This is assuming you are using bash, or a shell that can handle sub shells and pipes similar to bash.  


[[Category:Linux]][[Category:TipsnTricks]]
[[Category:Linux]][[Category:TipsnTricks]]

Revision as of 08:09, 29 April 2013

To run diff on two command outputs, such as two ls's, run:

 diff <(cd directory1; ls) <(cd directory2; ls)

This is assuming you are using bash, or a shell that can handle sub shells and pipes similar to bash.