bash prompt - long command circle back to same line after adding color

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












3















Note: I am using Putty and my TERM is set to XTERM.



I have added the color to my bash prompt as



PS1="[33[0;32m]d t ue[1;33m@H /W $ [33[1;37m]"


just to simplify PS1 in English -



$GREENd t uYELLOW@H W $ reset-color


Now, whenever my command is long and doesn't fit into the line of screen, it should come over to the next line, but it doesn't and the initial character start getting replaced which each character I type. The whole command is present but is not seen completely. It executes normally, so it's just the display that is getting distorted.



The situation worsens when I go back to the first character and try to delete the characters, the whole command line moves up and up erasing the previous data that was on screen.



After some trial and error removing some-part I found that addition a @ leads to the above behavior



e[1;33m


I really don't remember why I had put this and I am not able to trace this back.



Can you help me in resolving this issue? The long commands should get on the next line and not on the same line.










share|improve this question


























    3















    Note: I am using Putty and my TERM is set to XTERM.



    I have added the color to my bash prompt as



    PS1="[33[0;32m]d t ue[1;33m@H /W $ [33[1;37m]"


    just to simplify PS1 in English -



    $GREENd t uYELLOW@H W $ reset-color


    Now, whenever my command is long and doesn't fit into the line of screen, it should come over to the next line, but it doesn't and the initial character start getting replaced which each character I type. The whole command is present but is not seen completely. It executes normally, so it's just the display that is getting distorted.



    The situation worsens when I go back to the first character and try to delete the characters, the whole command line moves up and up erasing the previous data that was on screen.



    After some trial and error removing some-part I found that addition a @ leads to the above behavior



    e[1;33m


    I really don't remember why I had put this and I am not able to trace this back.



    Can you help me in resolving this issue? The long commands should get on the next line and not on the same line.










    share|improve this question
























      3












      3








      3


      2






      Note: I am using Putty and my TERM is set to XTERM.



      I have added the color to my bash prompt as



      PS1="[33[0;32m]d t ue[1;33m@H /W $ [33[1;37m]"


      just to simplify PS1 in English -



      $GREENd t uYELLOW@H W $ reset-color


      Now, whenever my command is long and doesn't fit into the line of screen, it should come over to the next line, but it doesn't and the initial character start getting replaced which each character I type. The whole command is present but is not seen completely. It executes normally, so it's just the display that is getting distorted.



      The situation worsens when I go back to the first character and try to delete the characters, the whole command line moves up and up erasing the previous data that was on screen.



      After some trial and error removing some-part I found that addition a @ leads to the above behavior



      e[1;33m


      I really don't remember why I had put this and I am not able to trace this back.



      Can you help me in resolving this issue? The long commands should get on the next line and not on the same line.










      share|improve this question














      Note: I am using Putty and my TERM is set to XTERM.



      I have added the color to my bash prompt as



      PS1="[33[0;32m]d t ue[1;33m@H /W $ [33[1;37m]"


      just to simplify PS1 in English -



      $GREENd t uYELLOW@H W $ reset-color


      Now, whenever my command is long and doesn't fit into the line of screen, it should come over to the next line, but it doesn't and the initial character start getting replaced which each character I type. The whole command is present but is not seen completely. It executes normally, so it's just the display that is getting distorted.



      The situation worsens when I go back to the first character and try to delete the characters, the whole command line moves up and up erasing the previous data that was on screen.



      After some trial and error removing some-part I found that addition a @ leads to the above behavior



      e[1;33m


      I really don't remember why I had put this and I am not able to trace this back.



      Can you help me in resolving this issue? The long commands should get on the next line and not on the same line.







      bash colors prompt






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 '13 at 10:04









      mtkmtk

      8,2132763103




      8,2132763103




















          1 Answer
          1






          active

          oldest

          votes


















          4














          The ANSI escape sequence right before the “@” sign is not enclosed in [ and ]. Enclose it and should be fine:



          PS1='[33[0;32m]d t u[e[1;33m]@H /W $ [33[1;37m]'


          By the way, what you call “reset-color” is just setting it to white. To actually reset it use 33[0m.






          share|improve this answer






















            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%2f69056%2fbash-prompt-long-command-circle-back-to-same-line-after-adding-color%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









            4














            The ANSI escape sequence right before the “@” sign is not enclosed in [ and ]. Enclose it and should be fine:



            PS1='[33[0;32m]d t u[e[1;33m]@H /W $ [33[1;37m]'


            By the way, what you call “reset-color” is just setting it to white. To actually reset it use 33[0m.






            share|improve this answer



























              4














              The ANSI escape sequence right before the “@” sign is not enclosed in [ and ]. Enclose it and should be fine:



              PS1='[33[0;32m]d t u[e[1;33m]@H /W $ [33[1;37m]'


              By the way, what you call “reset-color” is just setting it to white. To actually reset it use 33[0m.






              share|improve this answer

























                4












                4








                4







                The ANSI escape sequence right before the “@” sign is not enclosed in [ and ]. Enclose it and should be fine:



                PS1='[33[0;32m]d t u[e[1;33m]@H /W $ [33[1;37m]'


                By the way, what you call “reset-color” is just setting it to white. To actually reset it use 33[0m.






                share|improve this answer













                The ANSI escape sequence right before the “@” sign is not enclosed in [ and ]. Enclose it and should be fine:



                PS1='[33[0;32m]d t u[e[1;33m]@H /W $ [33[1;37m]'


                By the way, what you call “reset-color” is just setting it to white. To actually reset it use 33[0m.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 '13 at 10:10









                manatworkmanatwork

                21.8k38384




                21.8k38384



























                    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%2f69056%2fbash-prompt-long-command-circle-back-to-same-line-after-adding-color%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

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay