Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Alternate PS1 format, and solving resize problems in bash' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Alternate PS1 format, and solving resize problems in bash
Authored by: razzed on Apr 21, '09 09:13:00AM

I've found that when I resize the window in bash and iTerm, a lot of the times the shell will get confused and not figure out the window size correctly.

This usually manifests itself when typing out long lines, or using readline up and down to see previous commands. Rather annoying, up until today.

Often what I'll do is then do a

# TERM=xterm

or whatever and it will then figure it out.

With your above tip, I've fixed this issue by just setting the TERM on each prompt command. Not sure if this is the best way to do this, but it seems to work better and I'm not getting prematurely wrapped lines in bash anymore.

PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME%%.*}: ${PWD/#$HOME/~}07"; export TERM=xterm-color'

And, completely unrelated, a decent, Color Bash Prompt:

PS1='[e[34;1m]u@[e[31;1m]h [e[0m]w[e[0m] > '

Cobbled from various other sources, gives:

user@host cwd > _

Enjoy!

---
Kent Davidson
MarketRuler: Marketing Power Tools
http://www.marketruler.com/?_cr=macosxhints

[ Reply to This | # ]