250 lines
4.5 KiB
HTML
250 lines
4.5 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Problems</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Bash Prompt HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Introduction and Administrivia"
|
|
HREF="c23.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Document Versions, Comments and Suggestions"
|
|
HREF="x80.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="Credits/Bibliography"
|
|
HREF="x120.html"></HEAD
|
|
><BODY
|
|
CLASS="SECT1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Bash Prompt HOWTO: </TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x80.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 1. Introduction and Administrivia</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="x120.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="AEN89"
|
|
></A
|
|
>1.6. Problems</H1
|
|
><P
|
|
>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. </P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>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 <EM
|
|
>Learning the Bash Shell</EM
|
|
> second edition, p.260-262. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>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. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Xdefaults files can override colours. Look in
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>~/.Xdefaults</TT
|
|
> for
|
|
lines referring to <TT
|
|
CLASS="COMPUTEROUTPUT"
|
|
>XTerm*background</TT
|
|
>
|
|
and <TT
|
|
CLASS="COMPUTEROUTPUT"
|
|
>XTerm*foreground</TT
|
|
> (or possibly
|
|
<TT
|
|
CLASS="COMPUTEROUTPUT"
|
|
>XTerm*Background</TT
|
|
> and
|
|
<TT
|
|
CLASS="COMPUTEROUTPUT"
|
|
>XTerm*Foreground</TT
|
|
>). </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>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. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>ANSI cursor movement escape sequences aren't all implemented in all X
|
|
terminals. That's discussed in its own section. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>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. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>Things that work under Bash 1.14.7 don't necessarily work the
|
|
same under 2.0+, or vice versa. </P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>I often use the code <TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>PS1="...\\$${NO_COLOUR} "</B
|
|
></TT
|
|
> at
|
|
the end of my <TT
|
|
CLASS="ENVAR"
|
|
>PS1</TT
|
|
> string. The <TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>\\$</B
|
|
></TT
|
|
> is
|
|
replaced by a "$" for a normal user, and a "#" if you are root, and the
|
|
<TT
|
|
CLASS="ENVAR"
|
|
>${NO_COLOUR}</TT
|
|
> 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 <TT
|
|
CLASS="USERINPUT"
|
|
><B
|
|
>PS1="...\\$ ${NO_COLOUR}"</B
|
|
></TT
|
|
>
|
|
instead. I'm still trying to figure out how to get rid of that extra
|
|
space. </P
|
|
></LI
|
|
></UL
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x80.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="x120.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Document Versions, Comments and Suggestions</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="c23.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>Credits/Bibliography</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |