Diff Two Command Outputs: Difference between revisions
From Leo's Notes
This page was last edited on 1 September 2019, at 06:20.
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 ..." |
m Text replacement - "Category:Linux{{Navbox Linux}}" to "{{Navbox Linux}}Category:Linux" |
||
| (8 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
To | To {{code|diff}} the outputs of two command outputs, such as two {{code|ls}}'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 such as zsh. | ||
[[Category:Linux]][[Category:TipsnTricks]] | |||
{{Navbox Linux}}[[Category:Linux]] | |||
[[Category:TipsnTricks]] | |||
Latest revision as of 06:20, 1 September 2019
To diff the outputs of 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 such as zsh.