String `!23` is replaced with `docker` in command line Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionWhy is sed coming back with “unterminated `s' command”?How to run source with docker exec?Execute string with variables as commandnohup … & doesn't work as expected in docker scriptnull string as command in while loop: empty/null-commandWhy does command injection not work in this example?Testing an infinite loop in the background within Docker?execute command with sudo and execute Bash script with sudoAppend string on redirectExecute command from string with both single and double quotes

Monty Hall Problem-Probability Paradox

Is there any word for a place full of confusion?

Why datecode is SO IMPORTANT to chip manufacturers?

Does silver oxide react with hydrogen sulfide?

What is the difference between a "ranged attack" and a "ranged weapon attack"?

How to ask rejected full-time candidates to apply to teach individual courses?

Can an iPhone 7 be made to function as a NFC Tag?

Why not use the yoke to control yaw, as well as pitch and roll?

What initially awakened the Balrog?

What order were files/directories output in dir?

How many morphisms from 1 to 1+1 can there be?

Did any compiler fully use 80-bit floating point?

Is there hard evidence that the grant peer review system performs significantly better than random?

Simple Line in LaTeX Help!

Why is it faster to reheat something than it is to cook it?

In musical terms, what properties are varied by the human voice to produce different words / syllables?

Why weren't discrete x86 CPUs ever used in game hardware?

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?

"klopfte jemand" or "jemand klopfte"?

Is there public access to the Meteor Crater in Arizona?

What adaptations would allow standard fantasy dwarves to survive in the desert?

What would you call this weird metallic apparatus that allows you to lift people?

Did pre-Columbian Americans know the spherical shape of the Earth?

malloc in main() or malloc in another function: allocating memory for a struct and its members



String `!23` is replaced with `docker` in command line



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionWhy is sed coming back with “unterminated `s' command”?How to run source with docker exec?Execute string with variables as commandnohup … & doesn't work as expected in docker scriptnull string as command in while loop: empty/null-commandWhy does command injection not work in this example?Testing an infinite loop in the background within Docker?execute command with sudo and execute Bash script with sudoAppend string on redirectExecute command from string with both single and double quotes



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








15















I have a Maven command with the parameter:



mvn test -Dcommon_password=!23foo


This command is being executed as



mvn test -Dcommon_password=dockerfoo


I.e. !23 is being substituted with docker.
Why does this happen and how can I avoid it?










share|improve this question






























    15















    I have a Maven command with the parameter:



    mvn test -Dcommon_password=!23foo


    This command is being executed as



    mvn test -Dcommon_password=dockerfoo


    I.e. !23 is being substituted with docker.
    Why does this happen and how can I avoid it?










    share|improve this question


























      15












      15








      15


      1






      I have a Maven command with the parameter:



      mvn test -Dcommon_password=!23foo


      This command is being executed as



      mvn test -Dcommon_password=dockerfoo


      I.e. !23 is being substituted with docker.
      Why does this happen and how can I avoid it?










      share|improve this question
















      I have a Maven command with the parameter:



      mvn test -Dcommon_password=!23foo


      This command is being executed as



      mvn test -Dcommon_password=dockerfoo


      I.e. !23 is being substituted with docker.
      Why does this happen and how can I avoid it?







      bash






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 16 at 15:17









      Stephen Kitt

      182k26419497




      182k26419497










      asked Apr 16 at 15:00









      Vitalii PlagovVitalii Plagov

      329311




      329311




















          1 Answer
          1






          active

          oldest

          votes


















          41














          This is history expansion: !23 is replaced with the 23rd command in your history.



          To avoid this, use single quotes:



          mvn test '-Dcommon_password=!23foo'





          share|improve this answer


















          • 4





            or disable it completely with set +H/set +o histexpand

            – ilkkachu
            Apr 16 at 15:15






          • 11





            This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

            – JdeBP
            Apr 17 at 12:02












          • @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

            – Vitalii Plagov
            Apr 17 at 19:13











          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%2f512794%2fstring-23-is-replaced-with-docker-in-command-line%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          41














          This is history expansion: !23 is replaced with the 23rd command in your history.



          To avoid this, use single quotes:



          mvn test '-Dcommon_password=!23foo'





          share|improve this answer


















          • 4





            or disable it completely with set +H/set +o histexpand

            – ilkkachu
            Apr 16 at 15:15






          • 11





            This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

            – JdeBP
            Apr 17 at 12:02












          • @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

            – Vitalii Plagov
            Apr 17 at 19:13















          41














          This is history expansion: !23 is replaced with the 23rd command in your history.



          To avoid this, use single quotes:



          mvn test '-Dcommon_password=!23foo'





          share|improve this answer


















          • 4





            or disable it completely with set +H/set +o histexpand

            – ilkkachu
            Apr 16 at 15:15






          • 11





            This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

            – JdeBP
            Apr 17 at 12:02












          • @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

            – Vitalii Plagov
            Apr 17 at 19:13













          41












          41








          41







          This is history expansion: !23 is replaced with the 23rd command in your history.



          To avoid this, use single quotes:



          mvn test '-Dcommon_password=!23foo'





          share|improve this answer













          This is history expansion: !23 is replaced with the 23rd command in your history.



          To avoid this, use single quotes:



          mvn test '-Dcommon_password=!23foo'






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 16 at 15:09









          Stephen KittStephen Kitt

          182k26419497




          182k26419497







          • 4





            or disable it completely with set +H/set +o histexpand

            – ilkkachu
            Apr 16 at 15:15






          • 11





            This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

            – JdeBP
            Apr 17 at 12:02












          • @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

            – Vitalii Plagov
            Apr 17 at 19:13












          • 4





            or disable it completely with set +H/set +o histexpand

            – ilkkachu
            Apr 16 at 15:15






          • 11





            This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

            – JdeBP
            Apr 17 at 12:02












          • @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

            – Vitalii Plagov
            Apr 17 at 19:13







          4




          4





          or disable it completely with set +H/set +o histexpand

          – ilkkachu
          Apr 16 at 15:15





          or disable it completely with set +H/set +o histexpand

          – ilkkachu
          Apr 16 at 15:15




          11




          11





          This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

          – JdeBP
          Apr 17 at 12:02






          This is a password that can potentially contain all sorts of shell metacharacters. Properly quoting and escaping as in M. Kitt's answer is better than disabling just one of the possibilities that could occur. Of course, not having a password in process arguments in the first place would be better still. (-:

          – JdeBP
          Apr 17 at 12:02














          @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

          – Vitalii Plagov
          Apr 17 at 19:13





          @JdeBP in my question I showed a password in a plain text just for simplicity reason. In a real project that argument takes the value from a Jenkins secret credential. So it’s masked and safe.

          – Vitalii Plagov
          Apr 17 at 19:13

















          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%2f512794%2fstring-23-is-replaced-with-docker-in-command-line%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

          Sum ergo cogito? 1 nng

          三茅街道4182Guuntc Dn precexpngmageondP