View previous topic :: View next topic |
Author |
Message |
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Thu Nov 07, 2013 8:30 pm Post subject: PS1 not working correctly in non-X consoles? [SOLVED] |
|
|
When I'm in a non-X console on my system, the default PS1 setting coming from /etc/bash/bashrc:
Code: |
\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]
|
...isn't working correctly, and I'm sure that at one point it was working. The prompt ends up looking like this:
Code: | ;tom@dell2:~tom@dell2 ~ $ |
...where the end of that...everything starting at the second occurrence of "tom", are properly colored, and look like it does in an X console.
I have an nvidia card, but note that I'm not using a framebuffer console, and have no initrd etc...not sure if that makes a difference. Also note that my TERM is rxvt-256color, but changing that doesn't seem to have any affect.
Like I said, I'm sure that at one point this worked, and I don't think that default changed. Any ideas what's up there? Thanks.
Tom
Last edited by tld on Sun Nov 10, 2013 3:10 pm; edited 1 time in total |
|
Back to top |
|
|
666threesixes666 Veteran
Joined: 31 May 2011 Posts: 1248 Location: 42.68n 85.41w
|
Posted: Thu Nov 07, 2013 8:55 pm Post subject: |
|
|
cp .bashrc .bash_profile
1 or the other controls login terminals... dispatch-conf might of wiped out your .bashrc changes too. |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Fri Nov 08, 2013 2:49 pm Post subject: |
|
|
I'm not sure what you're getting at...I'm not talking about making (or loosing) any changes to the defaults. My PS1 is using the default from /etc/bash/bashrc like it always has, and it's set the same way for console or X terminal logins. It's just not displaying correctly in console logins for some reason.
Tom |
|
Back to top |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Sat Nov 09, 2013 3:25 am Post subject: |
|
|
I suggest you get rid of the 0's (zeros) that come right after the opening square brackets so you only have a single digit between the opening square bracket and the semi-colon. I frequently use ANSI escape sequences and I only have a single digit in that place. Maybe a single digit there is the lowest common denominator but that is just a guess. |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Sat Nov 09, 2013 3:32 pm Post subject: |
|
|
That didn't help at all. Also remember that we're talking about the default from the installed /etc/bash/bashrc (for color terminals), so I doubt there's anything wrong with that. There's something strange going on specifically when I'm in a non-X virtual console. I just discovered the following:
If I use this:
My prompt in the virtual console still looks like I explained above:
Code: | ;tom@dell2:~tom@dell2 ~ $ |
...just without the color. Also, if I unset PS1 altogether, I get this for a prompt:
...or, if I set PS1 to '>', I get:
It's as though that leading string is coming from somewhere else altogether, and the PS1 prompt is being used in addition to it(??). Where would that user@host be coming from if it's not coming from PS1?
Tom |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Sat Nov 09, 2013 3:56 pm Post subject: |
|
|
PROMPT_COMMAND? |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Sat Nov 09, 2013 3:56 pm Post subject: |
|
|
Interesting. The extra prompt text appears to be coming from the PROMPT_COMMAND variable (also set in /etc/bash/bashrc), and if I expressly unset that in my .bash_profile, by non-X console prompts are ok.
What I don't get is that this isn't happening on my other Gentoo machines, which all have that set to the default as well. I can even see that is I shell to one of them with and tee the output to a file:
Code: | ssh mythback | tee out.txt |
If I edit that output flie in binary mode (vi -b out.txt), it's clear that the output of $PROMPT_COMMAND is in fact showing in addition to the PS1 text, just like on this system...it just isn't causing any display issues in that case.
Strange.
Tom |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Sat Nov 09, 2013 3:58 pm Post subject: |
|
|
mv wrote: | PROMPT_COMMAND? |
You must have been about a second behind my post . Thanks. |
|
Back to top |
|
|
tld Veteran
Joined: 09 Dec 2003 Posts: 1816
|
Posted: Sun Nov 10, 2013 3:18 pm Post subject: |
|
|
It turned out that, because this workstation had been built way before my other Gentoo systems, my own ~/.bashrc still had all the code currently in /etc/bash/bashrc to set PROMPT_COMMAND, as was ending up setting that with the command to set X-window titles, even in virtual consoles.
Tom |
|
Back to top |
|
|
|