Bash: command not found












2















I have a script that needs to know the processor architecture. I'm doing this way:



if [["$(uname -m)" = "x86_64"]]; then
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
else
echo "Nossa! Você só pode usar 3,5GB de memória RAM. Que triste :( Vou baixar a versão 32bits pra você tá?"
wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.rpm
fi


But when I execute the code, I receive:



instala_chrome.sh: line 35: [[x86_64: command not found


Anyone can help me to solve this? Thanks!










share|improve this question





























    2















    I have a script that needs to know the processor architecture. I'm doing this way:



    if [["$(uname -m)" = "x86_64"]]; then
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
    else
    echo "Nossa! Você só pode usar 3,5GB de memória RAM. Que triste :( Vou baixar a versão 32bits pra você tá?"
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.rpm
    fi


    But when I execute the code, I receive:



    instala_chrome.sh: line 35: [[x86_64: command not found


    Anyone can help me to solve this? Thanks!










    share|improve this question



























      2












      2








      2








      I have a script that needs to know the processor architecture. I'm doing this way:



      if [["$(uname -m)" = "x86_64"]]; then
      wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
      else
      echo "Nossa! Você só pode usar 3,5GB de memória RAM. Que triste :( Vou baixar a versão 32bits pra você tá?"
      wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.rpm
      fi


      But when I execute the code, I receive:



      instala_chrome.sh: line 35: [[x86_64: command not found


      Anyone can help me to solve this? Thanks!










      share|improve this question
















      I have a script that needs to know the processor architecture. I'm doing this way:



      if [["$(uname -m)" = "x86_64"]]; then
      wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
      else
      echo "Nossa! Você só pode usar 3,5GB de memória RAM. Que triste :( Vou baixar a versão 32bits pra você tá?"
      wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.rpm
      fi


      But when I execute the code, I receive:



      instala_chrome.sh: line 35: [[x86_64: command not found


      Anyone can help me to solve this? Thanks!







      command-line bash scripts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 31 '12 at 10:38









      jokerdino

      32.5k21118186




      32.5k21118186










      asked Aug 31 '12 at 10:36









      Alexandre TelesAlexandre Teles

      1,062812




      1,062812






















          2 Answers
          2






          active

          oldest

          votes


















          5














          Better use:



          if [[ "$(uname -m)" == "x86_64" ]]; then


          Notice the space between [[ and first parameter, two = signs , and the space between "x86_64" and ]]



          Also, it is not a good idea to include ! inside echo :)



          I think that that's the best place to refer to when doing such operations: http://mywiki.wooledge.org/BashPitfalls






          share|improve this answer


























          • This works. Thank you. Can you recommend a online documentation for reading?

            – Alexandre Teles
            Aug 31 '12 at 14:21











          • Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

            – hytromo
            Aug 31 '12 at 15:00





















          3














          Actually you need a space after the [[ and a space before the ]] and the ]]; should be all together. Also, it is considered good practice to put #!/bin/bash as the first line of the script so that execution knows which shell to use.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            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%2faskubuntu.com%2fquestions%2f182545%2fbash-command-not-found%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









            5














            Better use:



            if [[ "$(uname -m)" == "x86_64" ]]; then


            Notice the space between [[ and first parameter, two = signs , and the space between "x86_64" and ]]



            Also, it is not a good idea to include ! inside echo :)



            I think that that's the best place to refer to when doing such operations: http://mywiki.wooledge.org/BashPitfalls






            share|improve this answer


























            • This works. Thank you. Can you recommend a online documentation for reading?

              – Alexandre Teles
              Aug 31 '12 at 14:21











            • Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

              – hytromo
              Aug 31 '12 at 15:00


















            5














            Better use:



            if [[ "$(uname -m)" == "x86_64" ]]; then


            Notice the space between [[ and first parameter, two = signs , and the space between "x86_64" and ]]



            Also, it is not a good idea to include ! inside echo :)



            I think that that's the best place to refer to when doing such operations: http://mywiki.wooledge.org/BashPitfalls






            share|improve this answer


























            • This works. Thank you. Can you recommend a online documentation for reading?

              – Alexandre Teles
              Aug 31 '12 at 14:21











            • Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

              – hytromo
              Aug 31 '12 at 15:00
















            5












            5








            5







            Better use:



            if [[ "$(uname -m)" == "x86_64" ]]; then


            Notice the space between [[ and first parameter, two = signs , and the space between "x86_64" and ]]



            Also, it is not a good idea to include ! inside echo :)



            I think that that's the best place to refer to when doing such operations: http://mywiki.wooledge.org/BashPitfalls






            share|improve this answer















            Better use:



            if [[ "$(uname -m)" == "x86_64" ]]; then


            Notice the space between [[ and first parameter, two = signs , and the space between "x86_64" and ]]



            Also, it is not a good idea to include ! inside echo :)



            I think that that's the best place to refer to when doing such operations: http://mywiki.wooledge.org/BashPitfalls







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 30 '18 at 8:42









            Sergiy Kolodyazhnyy

            70.6k9147310




            70.6k9147310










            answered Aug 31 '12 at 10:38









            hytromohytromo

            3,43632255




            3,43632255













            • This works. Thank you. Can you recommend a online documentation for reading?

              – Alexandre Teles
              Aug 31 '12 at 14:21











            • Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

              – hytromo
              Aug 31 '12 at 15:00





















            • This works. Thank you. Can you recommend a online documentation for reading?

              – Alexandre Teles
              Aug 31 '12 at 14:21











            • Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

              – hytromo
              Aug 31 '12 at 15:00



















            This works. Thank you. Can you recommend a online documentation for reading?

            – Alexandre Teles
            Aug 31 '12 at 14:21





            This works. Thank you. Can you recommend a online documentation for reading?

            – Alexandre Teles
            Aug 31 '12 at 14:21













            Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

            – hytromo
            Aug 31 '12 at 15:00







            Please see my edited answer. If you think that this works and it solved your problem (and only then), then please mark my answer as the accepted one as well.

            – hytromo
            Aug 31 '12 at 15:00















            3














            Actually you need a space after the [[ and a space before the ]] and the ]]; should be all together. Also, it is considered good practice to put #!/bin/bash as the first line of the script so that execution knows which shell to use.






            share|improve this answer




























              3














              Actually you need a space after the [[ and a space before the ]] and the ]]; should be all together. Also, it is considered good practice to put #!/bin/bash as the first line of the script so that execution knows which shell to use.






              share|improve this answer


























                3












                3








                3







                Actually you need a space after the [[ and a space before the ]] and the ]]; should be all together. Also, it is considered good practice to put #!/bin/bash as the first line of the script so that execution knows which shell to use.






                share|improve this answer













                Actually you need a space after the [[ and a space before the ]] and the ]]; should be all together. Also, it is considered good practice to put #!/bin/bash as the first line of the script so that execution knows which shell to use.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 1 '12 at 23:37









                Hey GaryHey Gary

                911




                911






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f182545%2fbash-command-not-found%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

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido