bash prompt - long command circle back to same line after adding color
Clash Royale CLAN TAG#URR8PPP
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
add a comment |
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
add a comment |
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
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
bash colors prompt
asked Mar 25 '13 at 10:04
mtkmtk
8,2132763103
8,2132763103
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered Mar 25 '13 at 10:10
manatworkmanatwork
21.8k38384
21.8k38384
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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