What !! means while calling echo [duplicate]












0
















This question already has an answer here:




  • What does “apt-get install !!” do and how to make it work?

    4 answers




Could somebody explain this output?



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


I expected sedond echo to write only !!










share|improve this question













marked as duplicate by karel, Elder Geek, N0rbert, Eric Carvalho, user68186 Feb 20 at 13:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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
    Feb 18 at 22:47











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

    – Sergiy Kolodyazhnyy
    Feb 18 at 23:30






  • 3





    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
    Feb 18 at 23:33
















0
















This question already has an answer here:




  • What does “apt-get install !!” do and how to make it work?

    4 answers




Could somebody explain this output?



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


I expected sedond echo to write only !!










share|improve this question













marked as duplicate by karel, Elder Geek, N0rbert, Eric Carvalho, user68186 Feb 20 at 13:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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
    Feb 18 at 22:47











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

    – Sergiy Kolodyazhnyy
    Feb 18 at 23:30






  • 3





    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
    Feb 18 at 23:33














0












0








0









This question already has an answer here:




  • What does “apt-get install !!” do and how to make it work?

    4 answers




Could somebody explain this output?



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


I expected sedond echo to write only !!










share|improve this question















This question already has an answer here:




  • What does “apt-get install !!” do and how to make it work?

    4 answers




Could somebody explain this output?



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


I expected sedond echo to write only !!





This question already has an answer here:




  • What does “apt-get install !!” do and how to make it work?

    4 answers








command-line echo






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 18 at 22:27









SanyashSanyash

1035




1035




marked as duplicate by karel, Elder Geek, N0rbert, Eric Carvalho, user68186 Feb 20 at 13:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by karel, Elder Geek, N0rbert, Eric Carvalho, user68186 Feb 20 at 13:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new 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
    Feb 18 at 22:47











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

    – Sergiy Kolodyazhnyy
    Feb 18 at 23:30






  • 3





    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
    Feb 18 at 23:33



















  • 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
    Feb 18 at 22:47











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

    – Sergiy Kolodyazhnyy
    Feb 18 at 23:30






  • 3





    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
    Feb 18 at 23:33

















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
Feb 18 at 22:47





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
Feb 18 at 22:47













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

– Sergiy Kolodyazhnyy
Feb 18 at 23:30





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

– Sergiy Kolodyazhnyy
Feb 18 at 23:30




3




3





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
Feb 18 at 23:33





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
Feb 18 at 23:33










2 Answers
2






active

oldest

votes


















2














!! means last command.



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






share|improve this answer































    1














    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
































      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      !! means last command.



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






      share|improve this answer




























        2














        !! means last command.



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






        share|improve this answer


























          2












          2








          2







          !! 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 Feb 18 at 22:33









          Manoj SawaiManoj Sawai

          6851720




          6851720

























              1














              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






























                1














                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




























                  1












                  1








                  1







                  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 Feb 18 at 23:23









                  wjandrea

                  9,46042664




                  9,46042664










                  answered Feb 18 at 22:33









                  FabbyFabby

                  27.1k1360161




                  27.1k1360161















                      Popular posts from this blog

                      How to make a Squid Proxy server?

                      Is this a new Fibonacci Identity?

                      Touch on Surface Book