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;








2















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.










share|improve this question









New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 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

















2















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.










share|improve this question









New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 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













2












2








2


1






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.










share|improve this question









New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












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






share|improve this question









New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Apr 15 at 9:32









Stephen Kitt

182k25419497




182k25419497






New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 15 at 1:08









user347221user347221

573




573




New contributor




user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user347221 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 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












  • 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







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










1 Answer
1






active

oldest

votes


















3














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 )





share|improve this answer

























    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.









    draft saved

    draft discarded


















    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









    3














    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 )





    share|improve this answer





























      3














      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 )





      share|improve this answer



























        3












        3








        3







        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 )





        share|improve this answer















        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 )






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 15 at 10:04

























        answered Apr 15 at 7:32









        Stephen KittStephen Kitt

        182k25419497




        182k25419497




















            user347221 is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Helsingborg Esperantistoj el Helsingborg | Vidu ankaŭ | Navigada menuo1 ŝanĝostabila versiopatrolita1 ŝanĝostabila versiopatrolita56°03′N 12°42′O  /  56.05°N, 12.7°O / 56.05; 12.7 (Helsingborg)56°03′N 12°42′O  /  56.05°N, 12.7°O / 56.05; 12.7 (Helsingborg)Helsingborg en la Vikimedia KomunejoKategorio Helsingborg en la Vikimedia KomunejoHelsingborg en la Vikimedia KomunejoKategorio Helsingborg en la Vikimedia Komunejo

            Linux Checkpoint SNX tool configuration issuesgetting Checkpoint VPN SSL Network Extender working in the command lineL2TP IPsec VPN client configurationOpenvpn stops respondingIssues with getting a tun0 connection to route any and all connections from eth0 to be made to this interface and if not working dropHow to setup port forwarding properly in FreeBsd 11?Getting certificate verify failed error in a Python applicationssh is unable to connect to server in VPNVPN SSL Network Extender in Firefoxgetting Checkpoint VPN SSL Network Extender working in the command lineisc-dhcp-server configurationUsing Checkpoint VPN SSL Network Extender CLI with certificate

            NetworkManager fails with “Could not find source connection”Trouble connecting to VPN using network-manager, while command line worksHow can I be notified about state changes to a VPN adapterBacktrack 5 R3 - Refuses to connect to VPNFeed all traffic through OpenVPN for a specific network namespace onlyRun daemon on startup in Debian once openvpn connection establishedpfsense tcp connection between openvpn and lan is brokenInternet connection problem with web browsers onlyWhy does NetworkManager explicitly support tun/tap devices?Browser issues with VPNTwo IP addresses assigned to the same network card - OpenVPN issues?Cannot connect to WiFi with nmcli, although secrets are provided