Darrell,
Here is a simple one for you. The 'tips' in konsole tips to set the prompt incorrectly uses a 'close' instead of 'open' bracket following the 'e' and incorrectly uses a ';' and omits the 'm' to terminate resetting the prompt background and bold state. The tips contain 3 similar references in the form:
export PS1=$PS1"[\e]0;\H:\w\a]"
This is wrong. It should be:
export PS1=$PS1"[\e[0m\H:\w\a]"
Note the second bracket is backwards... should be
PS1=$PS1"[\e[ ^
Further, to properly reset the background and bold state of the prompt (and to terminate non-printing characters) so that BASH can properly calculate prompt length and spacing, you must use '[\e0m' not [\e]0; (note the semicolon) The semicolon is used to separate the foreground/background colors not terminate the reset... You can see the differences when you look at the bad/good prompts stacked above/below each other:
export PS1=$PS1"[\e]0;\H:\w\a]" export PS1=$PS1"[\e[0m\H:\w\a]"
I've included a patch that fixes the existing 3 prompt tips and I have included 2 additional prompt tips as well.
Review, signoff and push. If you don't want the additional 2 tips, just trim them from the patch. (I always like additional tips :)
(no I won't explain how I found this :)
I've included a patch that fixes the existing 3 prompt tips and I have included 2 additional prompt tips as well.
Review, signoff and push. If you don't want the additional 2 tips, just trim them from the patch. (I always like additional tips :)
Looks sane, even for me! I'll push.
(no I won't explain how I found this :)
Well, I was going to ask how in jumping blue blazes you stumbled across those typos....
Yet I'm curious about one of the tips. Does $PS1 actually place the directory in the konsole window title? I thought $PROMPT_COMMAND had to be used to accomplish that (which is what I have used for many years). Is that tip technically correct?
Darrell
On 04/17/2012 05:46 PM, Darrell Anderson wrote:
Well, I was going to ask how in jumping blue blazes you stumbled across those typos....
Yet I'm curious about one of the tips. Does $PS1 actually place the directory in the konsole window title? I thought $PROMPT_COMMAND had to be used to accomplish that (which is what I have used for many years). Is that tip technically correct?
Darrell
Your environment has several prompts (up to 6 I think)
PS1 - your main prompt PS2 - secondary prompt ... and so on. PS1 is simply the environment variable name.
I've always enjoyed having a useful prompt:
http://www.ibm.com/developerworks/linux/library/l-tip-prompt/
The one I like for keeping me on time is:
PS1='[\e[0;37m]\A[\e[1;34m] [\e[1;34m]\h:\w> [\e[0m]'
I use a variation for 'root'
PS1="[\e[1;34m][[\e[1;31m]\A [\e[1;34m]\h[\e[0;31m]:\w[\e[1;34m]] # [\e[0m]"
When you use a prompt that provides hostname/path info, eg:
nirvana:/srv/http/dl/dt/tde>
Then to ftp, sftp, rsync, etc... files between hosts, I just select the prompt and I've already got the source or destination. I.e.:
rsync -uai nirvana:/srv/http/dl/dt/tde .
Your environment has several prompts (up to 6 I think)
Yup, yup, yup. I know that. :)
I was asking whether the tip itself is technically correct.
I recall long ago in a galaxy far away, that to get the directory name to appear in the konsole title bar required setting the $PROMPT_COMMAND in the environment. Of course, like many users, one I got things configured the way I wanted I haven't changed a doggone thing in many years. So now my gray matter is fuzzy about this.
I don't know. I know $PROMPT_COMMAND has something to do with getting something into the konsole title bar.
Darrell
On 04/17/2012 06:42 PM, Darrell Anderson wrote:
Yup, yup, yup. I know that. :)
I was asking whether the tip itself is technically correct.
I recall long ago in a galaxy far away, that to get the directory name to appear in the konsole title bar required setting the $PROMPT_COMMAND in the environment. Of course, like many users, one I got things configured the way I wanted I haven't changed a doggone thing in many years. So now my gray matter is fuzzy about this.
I don't know. I know $PROMPT_COMMAND has something to do with getting something into the konsole title bar.
Darrell
Ok...
Yes, like you I recall reading something like that years ago, but unlike the prompt itself, I've never tested whether that tip actually puts it in the titlebar :) (mostly because I don't want the path in the window :)
On 04/17/2012 10:23 PM, David C. Rankin wrote:
On 04/17/2012 06:42 PM, Darrell Anderson wrote:
Yup, yup, yup. I know that. :)
I was asking whether the tip itself is technically correct.
I recall long ago in a galaxy far away, that to get the directory name to appear in the konsole title bar required setting the $PROMPT_COMMAND in the environment. Of course, like many users, one I got things configured the way I wanted I haven't changed a doggone thing in many years. So now my gray matter is fuzzy about this.
I don't know. I know $PROMPT_COMMAND has something to do with getting something into the konsole title bar.
Darrell
Ok...
Yes, like you I recall reading something like that years ago, but unlike the prompt itself, I've never tested whether that tip actually puts it in the titlebar :) (mostly because I don't want the path in the window :)
I use this in my bashrc:
trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUG 2> /dev/null
It sets the title to whatever the last command I executed was. very useful :-)
Calvin