What !! means while calling echo












0















Could somebody explain this output?



$ echo !
!
$ echo !!
echo echo !
echo !
$


I expected sedond echo to write only !!










share|improve this question























  • If you view your command history & decide you want to run command 419 in that history, you can type !419 and it'll execute. Provided answers tell you !! executes your last command, but it has other uses too :)

    – guiverc
    4 hours ago











  • Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate

    – Sergiy Kolodyazhnyy
    3 hours ago











  • To prevent the !! from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!' gnu.org/software/bash/manual/html_node/Quoting.html

    – michael
    3 hours ago
















0















Could somebody explain this output?



$ echo !
!
$ echo !!
echo echo !
echo !
$


I expected sedond echo to write only !!










share|improve this question























  • If you view your command history & decide you want to run command 419 in that history, you can type !419 and it'll execute. Provided answers tell you !! executes your last command, but it has other uses too :)

    – guiverc
    4 hours ago











  • Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate

    – Sergiy Kolodyazhnyy
    3 hours ago











  • To prevent the !! from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!' gnu.org/software/bash/manual/html_node/Quoting.html

    – michael
    3 hours ago














0












0








0








Could somebody explain this output?



$ echo !
!
$ echo !!
echo echo !
echo !
$


I expected sedond echo to write only !!










share|improve this question














Could somebody explain this output?



$ echo !
!
$ echo !!
echo echo !
echo !
$


I expected sedond echo to write only !!







command-line echo






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 4 hours ago









SanyaSanya

12




12













  • If you view your command history & decide you want to run command 419 in that history, you can type !419 and it'll execute. Provided answers tell you !! executes your last command, but it has other uses too :)

    – guiverc
    4 hours ago











  • Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate

    – Sergiy Kolodyazhnyy
    3 hours ago











  • To prevent the !! from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!' gnu.org/software/bash/manual/html_node/Quoting.html

    – michael
    3 hours ago



















  • If you view your command history & decide you want to run command 419 in that history, you can type !419 and it'll execute. Provided answers tell you !! executes your last command, but it has other uses too :)

    – guiverc
    4 hours ago











  • Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate

    – Sergiy Kolodyazhnyy
    3 hours ago











  • To prevent the !! from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!' gnu.org/software/bash/manual/html_node/Quoting.html

    – michael
    3 hours ago

















If you view your command history & decide you want to run command 419 in that history, you can type !419 and it'll execute. Provided answers tell you !! executes your last command, but it has other uses too :)

– guiverc
4 hours ago





If you view your command history & decide you want to run command 419 in that history, you can type !419 and it'll execute. Provided answers tell you !! executes your last command, but it has other uses too :)

– guiverc
4 hours ago













Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate

– Sergiy Kolodyazhnyy
3 hours ago





Same question, although different context: askubuntu.com/q/627781/295286 Effectively duplicate

– Sergiy Kolodyazhnyy
3 hours ago













To prevent the !! from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!' gnu.org/software/bash/manual/html_node/Quoting.html

– michael
3 hours ago





To prevent the !! from being evaluated (it's being evaluated prior to executing the echo cmd), use quotes, eg echo '!!' gnu.org/software/bash/manual/html_node/Quoting.html

– michael
3 hours ago










2 Answers
2






active

oldest

votes


















1














!! means last command.



echo !! will echo last command, which was echo !.






share|improve this answer































    0














    Easily explained:



    $ echo 1
    1
    $ !!
    echo 1
    1


    so !! just repeats the last command, so



    echo !!


    does excactly what it's supposed to to!



    ;-)






    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%2f1119353%2fwhat-means-while-calling-echo%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














      !! means last command.



      echo !! will echo last command, which was echo !.






      share|improve this answer




























        1














        !! means last command.



        echo !! will echo last command, which was echo !.






        share|improve this answer


























          1












          1








          1







          !! means last command.



          echo !! will echo last command, which was echo !.






          share|improve this answer













          !! means last command.



          echo !! will echo last command, which was echo !.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Manoj SawaiManoj Sawai

          6641720




          6641720

























              0














              Easily explained:



              $ echo 1
              1
              $ !!
              echo 1
              1


              so !! just repeats the last command, so



              echo !!


              does excactly what it's supposed to to!



              ;-)






              share|improve this answer






























                0














                Easily explained:



                $ echo 1
                1
                $ !!
                echo 1
                1


                so !! just repeats the last command, so



                echo !!


                does excactly what it's supposed to to!



                ;-)






                share|improve this answer




























                  0












                  0








                  0







                  Easily explained:



                  $ echo 1
                  1
                  $ !!
                  echo 1
                  1


                  so !! just repeats the last command, so



                  echo !!


                  does excactly what it's supposed to to!



                  ;-)






                  share|improve this answer















                  Easily explained:



                  $ echo 1
                  1
                  $ !!
                  echo 1
                  1


                  so !! just repeats the last command, so



                  echo !!


                  does excactly what it's supposed to to!



                  ;-)







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 3 hours ago









                  wjandrea

                  9,22442463




                  9,22442463










                  answered 4 hours ago









                  FabbyFabby

                  26.8k1360161




                  26.8k1360161






























                      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%2f1119353%2fwhat-means-while-calling-echo%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

                      數位音樂下載

                      When can things happen in Etherscan, such as the picture below?

                      格利澤436b