Using diff to compare the output of two commands Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionHow to compare two different files line by line in unix?How to emulate Process Substitution in Dash?Diff the output of two `awk` commandshow to use patch and diff to merge two filesdiff two directories for changes and format output to use for scriptDiff tool with nice output like kdiff3How to color diff output?Comparing directories using diffCompare two files, while overriding second file's sizeHow to upload a file and then check it and run some other commands using only ssh, cat, and diff in a single SSH session?STDOUT + STDERR output … is there any difference between considering the output to be an empty string vs NULLDiff between two csv files based on the column
How often does castling occur in grandmaster games?
Is there hard evidence that the grant peer review system performs significantly better than random?
Strange behavior of Object.defineProperty() in JavaScript
Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
Search between two dates with specific time with each date
Time to Settle Down!
draw dynamic circle around node and edges
How many time did Arya actually used needle?
Belief In God or Knowledge Of God. Which is better?
Project Euler #1 in C++
What order were files/directories outputted in dir?
How come Sam didn't become Lord of Horn Hill?
How do I find out the mythology and history of my Fortress?
Do wooden building fires get hotter than 600°C?
How fail-safe is nr as stop bytes?
Can you explain what "processes and tools" means in the first Agile principle?
How to draw/optimize this graph with tikz
Aligning an equation at multiple points, with both left and right alignment, as well as equals sign alignment
Effects on objects due to a brief relocation of massive amounts of mass
Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?
How to dry out epoxy resin faster than usual?
How to compare two different files line by line in unix?
Significance of Cersei's obsession with elephants?
Using diff to compare the output of two commands
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow to compare two different files line by line in unix?How to emulate Process Substitution in Dash?Diff the output of two `awk` commandshow to use patch and diff to merge two filesdiff two directories for changes and format output to use for scriptDiff tool with nice output like kdiff3How to color diff output?Comparing directories using diffCompare two files, while overriding second file's sizeHow to upload a file and then check it and run some other commands using only ssh, cat, and diff in a single SSH session?STDOUT + STDERR output … is there any difference between considering the output to be an empty string vs NULLDiff between two csv files based on the column
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How does one go about using diff
to compare the output of two commands?
I know how to use it to compare the contents of a file filename1
with the output of a command cmd2
:
cmd | diff filename -
How do I make it so that I can have another command, say cmd1
in place of filename
?
I'm using dash, which doesn't support process substitution.
diff stdout dash
New contributor
add a comment |
How does one go about using diff
to compare the output of two commands?
I know how to use it to compare the contents of a file filename1
with the output of a command cmd2
:
cmd | diff filename -
How do I make it so that I can have another command, say cmd1
in place of filename
?
I'm using dash, which doesn't support process substitution.
diff stdout dash
New contributor
2
with process substitutiondiff <(cmd1) <(cmd2)
.
– mosvy
Apr 15 at 2:29
related unix.stackexchange.com/q/310500/72456
– αғsнιη
Apr 15 at 9:40
add a comment |
How does one go about using diff
to compare the output of two commands?
I know how to use it to compare the contents of a file filename1
with the output of a command cmd2
:
cmd | diff filename -
How do I make it so that I can have another command, say cmd1
in place of filename
?
I'm using dash, which doesn't support process substitution.
diff stdout dash
New contributor
How does one go about using diff
to compare the output of two commands?
I know how to use it to compare the contents of a file filename1
with the output of a command cmd2
:
cmd | diff filename -
How do I make it so that I can have another command, say cmd1
in place of filename
?
I'm using dash, which doesn't support process substitution.
diff stdout dash
diff stdout dash
New contributor
New contributor
edited Apr 15 at 9:32
Stephen Kitt
182k25419497
182k25419497
New contributor
asked Apr 15 at 1:08
user347221user347221
573
573
New contributor
New contributor
2
with process substitutiondiff <(cmd1) <(cmd2)
.
– mosvy
Apr 15 at 2:29
related unix.stackexchange.com/q/310500/72456
– αғsнιη
Apr 15 at 9:40
add a comment |
2
with process substitutiondiff <(cmd1) <(cmd2)
.
– mosvy
Apr 15 at 2:29
related unix.stackexchange.com/q/310500/72456
– αғsнιη
Apr 15 at 9:40
2
2
with process substitution
diff <(cmd1) <(cmd2)
.– mosvy
Apr 15 at 2:29
with process substitution
diff <(cmd1) <(cmd2)
.– mosvy
Apr 15 at 2:29
related unix.stackexchange.com/q/310500/72456
– αғsнιη
Apr 15 at 9:40
related unix.stackexchange.com/q/310500/72456
– αғsнιη
Apr 15 at 9:40
add a comment |
1 Answer
1
active
oldest
votes
Based on How to emulate Process Substitution in Dash? (thanks αғsнιη!), adjusted for dash
:
( cmd1 | ( cmd2 | ( diff /dev/fd/3 /dev/fd/4 ) 4<&0 ) 3<&0 )
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
user347221 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512467%2fusing-diff-to-compare-the-output-of-two-commands%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Based on How to emulate Process Substitution in Dash? (thanks αғsнιη!), adjusted for dash
:
( cmd1 | ( cmd2 | ( diff /dev/fd/3 /dev/fd/4 ) 4<&0 ) 3<&0 )
add a comment |
Based on How to emulate Process Substitution in Dash? (thanks αғsнιη!), adjusted for dash
:
( cmd1 | ( cmd2 | ( diff /dev/fd/3 /dev/fd/4 ) 4<&0 ) 3<&0 )
add a comment |
Based on How to emulate Process Substitution in Dash? (thanks αғsнιη!), adjusted for dash
:
( cmd1 | ( cmd2 | ( diff /dev/fd/3 /dev/fd/4 ) 4<&0 ) 3<&0 )
Based on How to emulate Process Substitution in Dash? (thanks αғsнιη!), adjusted for dash
:
( cmd1 | ( cmd2 | ( diff /dev/fd/3 /dev/fd/4 ) 4<&0 ) 3<&0 )
edited Apr 15 at 10:04
answered Apr 15 at 7:32
Stephen KittStephen Kitt
182k25419497
182k25419497
add a comment |
add a comment |
user347221 is a new contributor. Be nice, and check out our Code of Conduct.
user347221 is a new contributor. Be nice, and check out our Code of Conduct.
user347221 is a new contributor. Be nice, and check out our Code of Conduct.
user347221 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512467%2fusing-diff-to-compare-the-output-of-two-commands%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
with process substitution
diff <(cmd1) <(cmd2)
.– mosvy
Apr 15 at 2:29
related unix.stackexchange.com/q/310500/72456
– αғsнιη
Apr 15 at 9:40