Using spd-say in a bash script function The Next CEO of Stack OverflowRedirecting output when I execute “bash -c …” from a C programfor loop in bash functionWhat's the best way to make a bash function in a script as a parameter when running via command line?Execute only if it is a bash functionFunction for archiving arbitrary files with encryptionHow to make a function available to the command `parallel` (GNU)?How to catch and handle nonzero exit status within a Bash function?Bash function assign value to passed parameterPassing multiple arguments to sudo within functionHow to calculate say output duration?

Sending manuscript to multiple publishers

How powerful is the invisibility granted by the Gloom Stalker ranger's Umbral Sight feature?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Do I need to enable Dev Hub in my PROD Org?

If the heap is initialized for security, then why is the stack uninitialized?

Return the Closest Prime Number

Are there any limitations on attacking while grappling?

Non-deterministic sum of floats

Is "for causing autism in X" grammatical?

Won the lottery - how do I keep the money?

If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?

If a black hole is created from light, can this black hole then move at speed of light?

How to count occurrences of text in a file?

Is micro rebar a better way to reinforce concrete than rebar?

How to solve a differential equation with a term to a power?

Why am I allowed to create multiple unique pointers from a single object?

Would a galaxy be visible from outside, but nearby?

Inappropriate reference requests from Journal reviewers

Should I tutor a student who I know has cheated on their homework?

Elegant way to replace substring in a regex with optional groups in Python?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

How do I reset passwords on multiple websites easily?

Preparing Indesign booklet with .psd graphics for print

MessageLevel in QGIS3



Using spd-say in a bash script function



The Next CEO of Stack OverflowRedirecting output when I execute “bash -c …” from a C programfor loop in bash functionWhat's the best way to make a bash function in a script as a parameter when running via command line?Execute only if it is a bash functionFunction for archiving arbitrary files with encryptionHow to make a function available to the command `parallel` (GNU)?How to catch and handle nonzero exit status within a Bash function?Bash function assign value to passed parameterPassing multiple arguments to sudo within functionHow to calculate say output duration?










1















I'm sure this is fairly elementary, but I can't figure it out.



My script:



#!/bin/bash
sez ()

echo $1
spd-say "$1"

sez "does this work"
sez "this does work"


What I'm trying to make happen is use spd-say in a function to make the computer talk to me.



The echo portion of my function works. It outputs both lines of text that I feed to it in the expected order. However, the spd-say part doesn't. It only ever says the last line. I'm assuming it's because the second command is "overwriting" the output of the first because it's trying to run them in parallel to the same output. I've tried adding ;wait, &&, and various other things to the end of the sez command, on the next line after, within the function on the spd-say command, etc, but everything I'm trying isn't helping.



What am I doing wrong?










share|improve this question




























    1















    I'm sure this is fairly elementary, but I can't figure it out.



    My script:



    #!/bin/bash
    sez ()

    echo $1
    spd-say "$1"

    sez "does this work"
    sez "this does work"


    What I'm trying to make happen is use spd-say in a function to make the computer talk to me.



    The echo portion of my function works. It outputs both lines of text that I feed to it in the expected order. However, the spd-say part doesn't. It only ever says the last line. I'm assuming it's because the second command is "overwriting" the output of the first because it's trying to run them in parallel to the same output. I've tried adding ;wait, &&, and various other things to the end of the sez command, on the next line after, within the function on the spd-say command, etc, but everything I'm trying isn't helping.



    What am I doing wrong?










    share|improve this question


























      1












      1








      1








      I'm sure this is fairly elementary, but I can't figure it out.



      My script:



      #!/bin/bash
      sez ()

      echo $1
      spd-say "$1"

      sez "does this work"
      sez "this does work"


      What I'm trying to make happen is use spd-say in a function to make the computer talk to me.



      The echo portion of my function works. It outputs both lines of text that I feed to it in the expected order. However, the spd-say part doesn't. It only ever says the last line. I'm assuming it's because the second command is "overwriting" the output of the first because it's trying to run them in parallel to the same output. I've tried adding ;wait, &&, and various other things to the end of the sez command, on the next line after, within the function on the spd-say command, etc, but everything I'm trying isn't helping.



      What am I doing wrong?










      share|improve this question
















      I'm sure this is fairly elementary, but I can't figure it out.



      My script:



      #!/bin/bash
      sez ()

      echo $1
      spd-say "$1"

      sez "does this work"
      sez "this does work"


      What I'm trying to make happen is use spd-say in a function to make the computer talk to me.



      The echo portion of my function works. It outputs both lines of text that I feed to it in the expected order. However, the spd-say part doesn't. It only ever says the last line. I'm assuming it's because the second command is "overwriting" the output of the first because it's trying to run them in parallel to the same output. I've tried adding ;wait, &&, and various other things to the end of the sez command, on the next line after, within the function on the spd-say command, etc, but everything I'm trying isn't helping.



      What am I doing wrong?







      bash shell-script audio function text-to-speech






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 20 '18 at 22:35









      Rui F Ribeiro

      41.8k1483142




      41.8k1483142










      asked Oct 9 '16 at 15:06









      lightwinglightwing

      498




      498




















          2 Answers
          2






          active

          oldest

          votes


















          1














          I had a similar problem and I found a workaround. Instead of using spd-say I used espeak directly.






          share|improve this answer
































            0














            spd-say requires a suitable shell environment. cron doesn't execute tasks in your regular shell environment.



            You can try changing your script such as in this example:



            #!/bin/bash
            source $HOME/.profile
            sez ()

            echo $1
            spd-say "$1"

            sez "does this work"
            sez "this does work"


            See also this question for more information: http://unix.stackexchange.com/questions/67940/cron-ignores-variables-defined-in-bashrc-and-bash-profile






            share|improve this answer








            New contributor




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




















              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
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f315289%2fusing-spd-say-in-a-bash-script-function%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              I had a similar problem and I found a workaround. Instead of using spd-say I used espeak directly.






              share|improve this answer





























                1














                I had a similar problem and I found a workaround. Instead of using spd-say I used espeak directly.






                share|improve this answer



























                  1












                  1








                  1







                  I had a similar problem and I found a workaround. Instead of using spd-say I used espeak directly.






                  share|improve this answer















                  I had a similar problem and I found a workaround. Instead of using spd-say I used espeak directly.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 4 '16 at 14:05









                  Jeff Schaller

                  44.3k1162143




                  44.3k1162143










                  answered Dec 4 '16 at 10:00









                  alagrisalagris

                  465




                  465























                      0














                      spd-say requires a suitable shell environment. cron doesn't execute tasks in your regular shell environment.



                      You can try changing your script such as in this example:



                      #!/bin/bash
                      source $HOME/.profile
                      sez ()

                      echo $1
                      spd-say "$1"

                      sez "does this work"
                      sez "this does work"


                      See also this question for more information: http://unix.stackexchange.com/questions/67940/cron-ignores-variables-defined-in-bashrc-and-bash-profile






                      share|improve this answer








                      New contributor




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
























                        0














                        spd-say requires a suitable shell environment. cron doesn't execute tasks in your regular shell environment.



                        You can try changing your script such as in this example:



                        #!/bin/bash
                        source $HOME/.profile
                        sez ()

                        echo $1
                        spd-say "$1"

                        sez "does this work"
                        sez "this does work"


                        See also this question for more information: http://unix.stackexchange.com/questions/67940/cron-ignores-variables-defined-in-bashrc-and-bash-profile






                        share|improve this answer








                        New contributor




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






















                          0












                          0








                          0







                          spd-say requires a suitable shell environment. cron doesn't execute tasks in your regular shell environment.



                          You can try changing your script such as in this example:



                          #!/bin/bash
                          source $HOME/.profile
                          sez ()

                          echo $1
                          spd-say "$1"

                          sez "does this work"
                          sez "this does work"


                          See also this question for more information: http://unix.stackexchange.com/questions/67940/cron-ignores-variables-defined-in-bashrc-and-bash-profile






                          share|improve this answer








                          New contributor




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










                          spd-say requires a suitable shell environment. cron doesn't execute tasks in your regular shell environment.



                          You can try changing your script such as in this example:



                          #!/bin/bash
                          source $HOME/.profile
                          sez ()

                          echo $1
                          spd-say "$1"

                          sez "does this work"
                          sez "this does work"


                          See also this question for more information: http://unix.stackexchange.com/questions/67940/cron-ignores-variables-defined-in-bashrc-and-bash-profile







                          share|improve this answer








                          New contributor




                          user344053 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 answer



                          share|improve this answer






                          New contributor




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









                          answered 2 days ago









                          user344053user344053

                          1




                          1




                          New contributor




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





                          New contributor





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






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



























                              draft saved

                              draft discarded
















































                              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%2f315289%2fusing-spd-say-in-a-bash-script-function%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

                              getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                              Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                              Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.