1.6. Problems

This is a list of problems I've noticed while programming prompts. Don't start reading here, and don't let this list discourage you - these are mostly quite minor details. Just check back if you run into anything odd.

  • Many Bash features (such as math within $(()) among others) are compile time options. If you're using a binary distribution such as comes with a standard Linux distribution, all such features should be compiled in. But if you're working on someone else's system, this is worth keeping in mind if something you expected to work doesn't. Some notes about this in Learning the Bash Shell second edition, p.260-262.

  • The terminal screen manager "screen" doesn't always get along with ANSI colours. I'm not a screen expert, unfortunately. Versions older than 3.7.6 may cause problems, but newer versions seem to work well in all cases. Old versions reduce all prompt colours to the standard foreground colour in X terminals.

  • Xdefaults files can override colours. Look in ~/.Xdefaults for lines referring to XTerm*background and XTerm*foreground (or possibly XTerm*Background and XTerm*Foreground).

  • One of the prompts mentioned in this document uses the output of "jobs" - as discussed at that time, "jobs" output to a pipe is broken in Bash 2.02.

  • ANSI cursor movement escape sequences aren't all implemented in all X terminals. That's discussed in its own section.

  • Some nice looking pseudo-graphics can be created by using a VGA font rather than standard Linux fonts. Unfortunately, these effects look awful if you don't use a VGA font, and there's no way to detect within a term what kind of font it's using.

  • Things that work under Bash 1.14.7 don't necessarily work the same under 2.0+, or vice versa.

  • I often use the code PS1="...\\$${NO_COLOUR} " at the end of my PS1 string. The \\$ is replaced by a "$" for a normal user, and a "#" if you are root, and the ${NO_COLOUR} is an escape sequence that stops any colour modifications made by the prompt. However, I've had problems seeing the "#" when I'm root. I believe this is because Bash doesn't like two dollar signs in a row. Use PS1="...\\$ ${NO_COLOUR}" instead. I'm still trying to figure out how to get rid of that extra space.

Copyright © 2010-2024 Platon Technologies, s.r.o.           Index | Man stránky | tLDP | Dokumenty | Utilitky | O projekte
Design by styleshout