Redirecting output from a bash command into a script











up vote
0
down vote

favorite












I'm trying to do some stuff with QR codes and a found a library called ZBar. Once installed it comes with a bash command called zbarcam which reads from a camera and continuously prints out whenever it scans and decodes a QR code (it prints out the decoded value of the QR). I want to, instead of printing the output, take the output and give it as an input to another script so I can do some things with it. TL;DR how can a continuously capture the output from zbarcam and pass it to my script as an input.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I'm trying to do some stuff with QR codes and a found a library called ZBar. Once installed it comes with a bash command called zbarcam which reads from a camera and continuously prints out whenever it scans and decodes a QR code (it prints out the decoded value of the QR). I want to, instead of printing the output, take the output and give it as an input to another script so I can do some things with it. TL;DR how can a continuously capture the output from zbarcam and pass it to my script as an input.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to do some stuff with QR codes and a found a library called ZBar. Once installed it comes with a bash command called zbarcam which reads from a camera and continuously prints out whenever it scans and decodes a QR code (it prints out the decoded value of the QR). I want to, instead of printing the output, take the output and give it as an input to another script so I can do some things with it. TL;DR how can a continuously capture the output from zbarcam and pass it to my script as an input.










      share|improve this question















      I'm trying to do some stuff with QR codes and a found a library called ZBar. Once installed it comes with a bash command called zbarcam which reads from a camera and continuously prints out whenever it scans and decodes a QR code (it prints out the decoded value of the QR). I want to, instead of printing the output, take the output and give it as an input to another script so I can do some things with it. TL;DR how can a continuously capture the output from zbarcam and pass it to my script as an input.







      bash shell qr-code zbar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 11:51









      Rohit Verma

      1,4332623




      1,4332623










      asked Nov 8 at 10:08









      konstabtin konatantinov

      1




      1
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Is it from zbar?



          They have an example in their manpage:




          Scan for barcodes using the second video device and pipe the resulting data through a script that searches for each code in a database and does something useful with them:



          zbarcam /dev/video1 | upcrpc.py



          The upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found.







          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',
            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%2f53205482%2fredirecting-output-from-a-bash-command-into-a-script%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Is it from zbar?



            They have an example in their manpage:




            Scan for barcodes using the second video device and pipe the resulting data through a script that searches for each code in a database and does something useful with them:



            zbarcam /dev/video1 | upcrpc.py



            The upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found.







            share|improve this answer

























              up vote
              0
              down vote













              Is it from zbar?



              They have an example in their manpage:




              Scan for barcodes using the second video device and pipe the resulting data through a script that searches for each code in a database and does something useful with them:



              zbarcam /dev/video1 | upcrpc.py



              The upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found.







              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                Is it from zbar?



                They have an example in their manpage:




                Scan for barcodes using the second video device and pipe the resulting data through a script that searches for each code in a database and does something useful with them:



                zbarcam /dev/video1 | upcrpc.py



                The upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found.







                share|improve this answer












                Is it from zbar?



                They have an example in their manpage:




                Scan for barcodes using the second video device and pipe the resulting data through a script that searches for each code in a database and does something useful with them:



                zbarcam /dev/video1 | upcrpc.py



                The upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found.








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 8 at 12:03









                seeseost

                1826




                1826






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205482%2fredirecting-output-from-a-bash-command-into-a-script%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    Popular posts from this blog

                    Landwehr

                    Reims

                    Schenkenzell