Syntax error near unexpected token `done'












4















I'm trying to get this while loop (using nano) to download some websites from this URL but I keep getting the error "syntax error near unexpected token `done'":



while read <FIRST-LAST> do
echo FIRST-LAST
curl -O https://www.uoguelph.ca/arts/history/people/FIRST-LAST
done < formatted_history.txt









share|improve this question





























    4















    I'm trying to get this while loop (using nano) to download some websites from this URL but I keep getting the error "syntax error near unexpected token `done'":



    while read <FIRST-LAST> do
    echo FIRST-LAST
    curl -O https://www.uoguelph.ca/arts/history/people/FIRST-LAST
    done < formatted_history.txt









    share|improve this question



























      4












      4








      4








      I'm trying to get this while loop (using nano) to download some websites from this URL but I keep getting the error "syntax error near unexpected token `done'":



      while read <FIRST-LAST> do
      echo FIRST-LAST
      curl -O https://www.uoguelph.ca/arts/history/people/FIRST-LAST
      done < formatted_history.txt









      share|improve this question
















      I'm trying to get this while loop (using nano) to download some websites from this URL but I keep getting the error "syntax error near unexpected token `done'":



      while read <FIRST-LAST> do
      echo FIRST-LAST
      curl -O https://www.uoguelph.ca/arts/history/people/FIRST-LAST
      done < formatted_history.txt






      bash shell-script shell






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 25 '18 at 10:05









      Tshepang

      26.1k71186264




      26.1k71186264










      asked Jan 20 '17 at 0:28









      Daniela BustamanteDaniela Bustamante

      2314




      2314






















          2 Answers
          2






          active

          oldest

          votes


















          4















          • Either the do should appear on a new line, or it needs to have a semi-colon inserted in front of it


          • <FIRST-LAST> should actually be the name of a shell variable, and FIRST-LAST should be a reference to that variable. < and > are not legal characters for shell variables, so we can deduce that something else must be substituted here instead. person seems to be as good a variable name as any in this particular case.


          I think something like this should work much better:



          while read person ; do
          echo "${person}"
          curl -O "https://www.uoguelph.ca/arts/history/people/${person}"
          done < formatted_history.txt


          This assumes that the file formatted_history.txt actually exists in the current directory and is a list of people from the https://www.uoguelph.ca/arts/history/people/ page - something like:



          tara-abraham
          donna-andrew
          susan-armstrong-reid
          ... etc ...





          share|improve this answer





















          • 3





            THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

            – Daniela Bustamante
            Jan 20 '17 at 1:14



















          0














          I'm trying to execute below in git bash but I keep getting the error "syntax error near unexpected token `done'"



          Could you please help out



          if [ ! -e ~/.ssh/id_rsa ]; then ssh-keygen -b 4096; done






          share|improve this answer








          New contributor




          Anusha 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%2f338757%2fsyntax-error-near-unexpected-token-done%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









            4















            • Either the do should appear on a new line, or it needs to have a semi-colon inserted in front of it


            • <FIRST-LAST> should actually be the name of a shell variable, and FIRST-LAST should be a reference to that variable. < and > are not legal characters for shell variables, so we can deduce that something else must be substituted here instead. person seems to be as good a variable name as any in this particular case.


            I think something like this should work much better:



            while read person ; do
            echo "${person}"
            curl -O "https://www.uoguelph.ca/arts/history/people/${person}"
            done < formatted_history.txt


            This assumes that the file formatted_history.txt actually exists in the current directory and is a list of people from the https://www.uoguelph.ca/arts/history/people/ page - something like:



            tara-abraham
            donna-andrew
            susan-armstrong-reid
            ... etc ...





            share|improve this answer





















            • 3





              THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

              – Daniela Bustamante
              Jan 20 '17 at 1:14
















            4















            • Either the do should appear on a new line, or it needs to have a semi-colon inserted in front of it


            • <FIRST-LAST> should actually be the name of a shell variable, and FIRST-LAST should be a reference to that variable. < and > are not legal characters for shell variables, so we can deduce that something else must be substituted here instead. person seems to be as good a variable name as any in this particular case.


            I think something like this should work much better:



            while read person ; do
            echo "${person}"
            curl -O "https://www.uoguelph.ca/arts/history/people/${person}"
            done < formatted_history.txt


            This assumes that the file formatted_history.txt actually exists in the current directory and is a list of people from the https://www.uoguelph.ca/arts/history/people/ page - something like:



            tara-abraham
            donna-andrew
            susan-armstrong-reid
            ... etc ...





            share|improve this answer





















            • 3





              THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

              – Daniela Bustamante
              Jan 20 '17 at 1:14














            4












            4








            4








            • Either the do should appear on a new line, or it needs to have a semi-colon inserted in front of it


            • <FIRST-LAST> should actually be the name of a shell variable, and FIRST-LAST should be a reference to that variable. < and > are not legal characters for shell variables, so we can deduce that something else must be substituted here instead. person seems to be as good a variable name as any in this particular case.


            I think something like this should work much better:



            while read person ; do
            echo "${person}"
            curl -O "https://www.uoguelph.ca/arts/history/people/${person}"
            done < formatted_history.txt


            This assumes that the file formatted_history.txt actually exists in the current directory and is a list of people from the https://www.uoguelph.ca/arts/history/people/ page - something like:



            tara-abraham
            donna-andrew
            susan-armstrong-reid
            ... etc ...





            share|improve this answer
















            • Either the do should appear on a new line, or it needs to have a semi-colon inserted in front of it


            • <FIRST-LAST> should actually be the name of a shell variable, and FIRST-LAST should be a reference to that variable. < and > are not legal characters for shell variables, so we can deduce that something else must be substituted here instead. person seems to be as good a variable name as any in this particular case.


            I think something like this should work much better:



            while read person ; do
            echo "${person}"
            curl -O "https://www.uoguelph.ca/arts/history/people/${person}"
            done < formatted_history.txt


            This assumes that the file formatted_history.txt actually exists in the current directory and is a list of people from the https://www.uoguelph.ca/arts/history/people/ page - something like:



            tara-abraham
            donna-andrew
            susan-armstrong-reid
            ... etc ...






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 20 '17 at 16:54









            DopeGhoti

            45.9k55988




            45.9k55988










            answered Jan 20 '17 at 0:40









            Digital TraumaDigital Trauma

            5,90211528




            5,90211528








            • 3





              THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

              – Daniela Bustamante
              Jan 20 '17 at 1:14














            • 3





              THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

              – Daniela Bustamante
              Jan 20 '17 at 1:14








            3




            3





            THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

            – Daniela Bustamante
            Jan 20 '17 at 1:14





            THANK YOU SO MUCH! This worked perfectly, I can't explain how long this has taken me and you just answered it. Thank you!!!

            – Daniela Bustamante
            Jan 20 '17 at 1:14













            0














            I'm trying to execute below in git bash but I keep getting the error "syntax error near unexpected token `done'"



            Could you please help out



            if [ ! -e ~/.ssh/id_rsa ]; then ssh-keygen -b 4096; done






            share|improve this answer








            New contributor




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

























              0














              I'm trying to execute below in git bash but I keep getting the error "syntax error near unexpected token `done'"



              Could you please help out



              if [ ! -e ~/.ssh/id_rsa ]; then ssh-keygen -b 4096; done






              share|improve this answer








              New contributor




              Anusha 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







                I'm trying to execute below in git bash but I keep getting the error "syntax error near unexpected token `done'"



                Could you please help out



                if [ ! -e ~/.ssh/id_rsa ]; then ssh-keygen -b 4096; done






                share|improve this answer








                New contributor




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










                I'm trying to execute below in git bash but I keep getting the error "syntax error near unexpected token `done'"



                Could you please help out



                if [ ! -e ~/.ssh/id_rsa ]; then ssh-keygen -b 4096; done







                share|improve this answer








                New contributor




                Anusha 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




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









                answered 10 mins ago









                AnushaAnusha

                1




                1




                New contributor




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





                New contributor





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






                Anusha 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%2f338757%2fsyntax-error-near-unexpected-token-done%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

                    Accessing regular linux commands in Huawei's Dopra Linux

                    Can't connect RFCOMM socket: Host is down

                    Kernel panic - not syncing: Fatal Exception in Interrupt