Bash connectors with async files










0















I have a file database/seed.js that performs an async insertion into a database.



If I run node database/seed.js && mongo < ./database/updateCounter.js, am I guaranteed that mongo < ./database/updateCounter.js will run after the async insertion is fully complete?



This answer says A && B means B will only run if A was successful, but how is success determined?










share|improve this question


























    0















    I have a file database/seed.js that performs an async insertion into a database.



    If I run node database/seed.js && mongo < ./database/updateCounter.js, am I guaranteed that mongo < ./database/updateCounter.js will run after the async insertion is fully complete?



    This answer says A && B means B will only run if A was successful, but how is success determined?










    share|improve this question
























      0












      0








      0








      I have a file database/seed.js that performs an async insertion into a database.



      If I run node database/seed.js && mongo < ./database/updateCounter.js, am I guaranteed that mongo < ./database/updateCounter.js will run after the async insertion is fully complete?



      This answer says A && B means B will only run if A was successful, but how is success determined?










      share|improve this question














      I have a file database/seed.js that performs an async insertion into a database.



      If I run node database/seed.js && mongo < ./database/updateCounter.js, am I guaranteed that mongo < ./database/updateCounter.js will run after the async insertion is fully complete?



      This answer says A && B means B will only run if A was successful, but how is success determined?







      bash command-line






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 18:08









      mrwnt10mrwnt10

      190214




      190214






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Success is determined by the exit status of the command.



          Each linux process when terminates returns a integer called exit status. This is the number you usually see in the statements return 0 in most programming languages.



          From bash manual 3.2.3 List of Commands:




          An AND list has the form



          command1 && command2


          command2 is executed if, and only if, command1 returns an exit status of zero.




          Exit status equal to zero usually means success and nonzero exit status means failure. Like in case of grep - exit status equal to 0 means pattern was found in file/stream, exit status of grep equal to 1 means no pattern was found in file/stream. There are two simple programs in bash or shell builtins - true and false, the first returns status 0 and the other returns with status 1. This is opposed to boolean values in programming languages - usually true is defined as having nonzero value, usually 1, and false is defined as equal to zero.



          In your question there is used the word "async" which indicates that the action takes place asynchronously. Usually means that the action has started or is requested to start, but may or may not have finished and with what result. I don't know what database/seed.js does and how it works - inspect it and refer to it to know what exit status it sets on which conditions.



          But if you run node database/seed.js && mongo < ./database/updateCounter.js you are "guaranteed" that mongo program will execute if, and only if, the node program has terminated with exit status of zero. I quoted "guaranteed", because noone guarantees you that in any way - bash is licensed under GNU General Public License and you can read in the license clearly that:




          1. Disclaimer of Warranty.

            THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53287076%2fbash-connectors-with-async-files%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









            0














            Success is determined by the exit status of the command.



            Each linux process when terminates returns a integer called exit status. This is the number you usually see in the statements return 0 in most programming languages.



            From bash manual 3.2.3 List of Commands:




            An AND list has the form



            command1 && command2


            command2 is executed if, and only if, command1 returns an exit status of zero.




            Exit status equal to zero usually means success and nonzero exit status means failure. Like in case of grep - exit status equal to 0 means pattern was found in file/stream, exit status of grep equal to 1 means no pattern was found in file/stream. There are two simple programs in bash or shell builtins - true and false, the first returns status 0 and the other returns with status 1. This is opposed to boolean values in programming languages - usually true is defined as having nonzero value, usually 1, and false is defined as equal to zero.



            In your question there is used the word "async" which indicates that the action takes place asynchronously. Usually means that the action has started or is requested to start, but may or may not have finished and with what result. I don't know what database/seed.js does and how it works - inspect it and refer to it to know what exit status it sets on which conditions.



            But if you run node database/seed.js && mongo < ./database/updateCounter.js you are "guaranteed" that mongo program will execute if, and only if, the node program has terminated with exit status of zero. I quoted "guaranteed", because noone guarantees you that in any way - bash is licensed under GNU General Public License and you can read in the license clearly that:




            1. Disclaimer of Warranty.

              THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.






            share|improve this answer





























              0














              Success is determined by the exit status of the command.



              Each linux process when terminates returns a integer called exit status. This is the number you usually see in the statements return 0 in most programming languages.



              From bash manual 3.2.3 List of Commands:




              An AND list has the form



              command1 && command2


              command2 is executed if, and only if, command1 returns an exit status of zero.




              Exit status equal to zero usually means success and nonzero exit status means failure. Like in case of grep - exit status equal to 0 means pattern was found in file/stream, exit status of grep equal to 1 means no pattern was found in file/stream. There are two simple programs in bash or shell builtins - true and false, the first returns status 0 and the other returns with status 1. This is opposed to boolean values in programming languages - usually true is defined as having nonzero value, usually 1, and false is defined as equal to zero.



              In your question there is used the word "async" which indicates that the action takes place asynchronously. Usually means that the action has started or is requested to start, but may or may not have finished and with what result. I don't know what database/seed.js does and how it works - inspect it and refer to it to know what exit status it sets on which conditions.



              But if you run node database/seed.js && mongo < ./database/updateCounter.js you are "guaranteed" that mongo program will execute if, and only if, the node program has terminated with exit status of zero. I quoted "guaranteed", because noone guarantees you that in any way - bash is licensed under GNU General Public License and you can read in the license clearly that:




              1. Disclaimer of Warranty.

                THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.






              share|improve this answer



























                0












                0








                0







                Success is determined by the exit status of the command.



                Each linux process when terminates returns a integer called exit status. This is the number you usually see in the statements return 0 in most programming languages.



                From bash manual 3.2.3 List of Commands:




                An AND list has the form



                command1 && command2


                command2 is executed if, and only if, command1 returns an exit status of zero.




                Exit status equal to zero usually means success and nonzero exit status means failure. Like in case of grep - exit status equal to 0 means pattern was found in file/stream, exit status of grep equal to 1 means no pattern was found in file/stream. There are two simple programs in bash or shell builtins - true and false, the first returns status 0 and the other returns with status 1. This is opposed to boolean values in programming languages - usually true is defined as having nonzero value, usually 1, and false is defined as equal to zero.



                In your question there is used the word "async" which indicates that the action takes place asynchronously. Usually means that the action has started or is requested to start, but may or may not have finished and with what result. I don't know what database/seed.js does and how it works - inspect it and refer to it to know what exit status it sets on which conditions.



                But if you run node database/seed.js && mongo < ./database/updateCounter.js you are "guaranteed" that mongo program will execute if, and only if, the node program has terminated with exit status of zero. I quoted "guaranteed", because noone guarantees you that in any way - bash is licensed under GNU General Public License and you can read in the license clearly that:




                1. Disclaimer of Warranty.

                  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.






                share|improve this answer















                Success is determined by the exit status of the command.



                Each linux process when terminates returns a integer called exit status. This is the number you usually see in the statements return 0 in most programming languages.



                From bash manual 3.2.3 List of Commands:




                An AND list has the form



                command1 && command2


                command2 is executed if, and only if, command1 returns an exit status of zero.




                Exit status equal to zero usually means success and nonzero exit status means failure. Like in case of grep - exit status equal to 0 means pattern was found in file/stream, exit status of grep equal to 1 means no pattern was found in file/stream. There are two simple programs in bash or shell builtins - true and false, the first returns status 0 and the other returns with status 1. This is opposed to boolean values in programming languages - usually true is defined as having nonzero value, usually 1, and false is defined as equal to zero.



                In your question there is used the word "async" which indicates that the action takes place asynchronously. Usually means that the action has started or is requested to start, but may or may not have finished and with what result. I don't know what database/seed.js does and how it works - inspect it and refer to it to know what exit status it sets on which conditions.



                But if you run node database/seed.js && mongo < ./database/updateCounter.js you are "guaranteed" that mongo program will execute if, and only if, the node program has terminated with exit status of zero. I quoted "guaranteed", because noone guarantees you that in any way - bash is licensed under GNU General Public License and you can read in the license clearly that:




                1. Disclaimer of Warranty.

                  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 13 '18 at 18:28

























                answered Nov 13 '18 at 18:17









                Kamil CukKamil Cuk

                11.1k1528




                11.1k1528





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f53287076%2fbash-connectors-with-async-files%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

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20