old-www/HOWTO/Bash-Prompt-HOWTO/index.html

594 lines
7.5 KiB
HTML

<HTML
><HEAD
><TITLE
>Bash Prompt HOWTO</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="NEXT"
TITLE="Introduction and Administrivia"
HREF="c23.html"></HEAD
><BODY
CLASS="BOOK"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="BOOK"
><A
NAME="AEN1"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
><A
NAME="AEN2"
></A
>Bash Prompt HOWTO</H1
><H2
CLASS="SUBTITLE"
>$Revision: 0.93 $, $Date: 2003/11/06 02:12:02 $</H2
><H3
CLASS="AUTHOR"
><A
NAME="AEN14"
></A
>Giles Orr</H3
><P
CLASS="COPYRIGHT"
><A
HREF="ln12.html"
>Copyright</A
> &copy; 1998, 1999, 2000, 2001, 2003 Giles Orr</P
><DIV
><DIV
CLASS="ABSTRACT"
><A
NAME="AEN20"
></A
><P
></P
><P
>Creating and controlling terminal and xterm prompts is discussed,
including incorporating standard escape sequences to give username,
current working directory, time, etc. Further suggestions are made
on how to modify xterm title bars, use external functions to provide
prompt information, and how to use ANSI colours.&#13;</P
><P
></P
></DIV
></DIV
><HR></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>1. <A
HREF="c23.html"
>Introduction and Administrivia</A
></DT
><DD
><DL
><DT
>1.1. <A
HREF="x25.html"
>Introduction</A
></DT
><DT
>1.2. <A
HREF="x30.html"
>Revision History</A
></DT
><DT
>1.3. <A
HREF="x71.html"
>Requirements</A
></DT
><DT
>1.4. <A
HREF="x77.html"
>How To Use This Document</A
></DT
><DT
>1.5. <A
HREF="x80.html"
>Document Versions, Comments and Suggestions</A
></DT
><DT
>1.6. <A
HREF="x89.html"
>Problems</A
></DT
><DT
>1.7. <A
HREF="x120.html"
>Credits/Bibliography</A
></DT
><DT
>1.8. <A
HREF="x138.html"
>Disclaimer</A
></DT
></DL
></DD
><DT
>2. <A
HREF="c141.html"
>Bash and Bash Prompts</A
></DT
><DD
><DL
><DT
>2.1. <A
HREF="x143.html"
>What is Bash?</A
></DT
><DT
>2.2. <A
HREF="x149.html"
>What Can Tweaking Your Bash Prompt Do For You?</A
></DT
><DT
>2.3. <A
HREF="x152.html"
>Why Bother?</A
></DT
><DT
>2.4. <A
HREF="x157.html"
>The First Step</A
></DT
><DT
>2.5. <A
HREF="bash-prompt-escape-sequences.html"
>Bash Prompt Escape Sequences</A
></DT
><DT
>2.6. <A
HREF="setps.html"
>Setting the PS? Strings Permanently</A
></DT
></DL
></DD
><DT
>3. <A
HREF="c189.html"
>Bash Programming and Shell Scripts</A
></DT
><DD
><DL
><DT
>3.1. <A
HREF="x191.html"
>Variables</A
></DT
><DT
>3.2. <A
HREF="x206.html"
>Quotes and Special Characters</A
></DT
><DT
>3.3. <A
HREF="x219.html"
>Command Substitution</A
></DT
><DT
>3.4. <A
HREF="nonprintingchars.html"
>Non-Printing Characters in Prompts</A
></DT
><DT
>3.5. <A
HREF="x237.html"
>Sourcing a File</A
></DT
><DT
>3.6. <A
HREF="x246.html"
>Functions, Aliases, and the Environment</A
></DT
></DL
></DD
><DT
>4. <A
HREF="c262.html"
>External Commands</A
></DT
><DD
><DL
><DT
>4.1. <A
HREF="x264.html"
>PROMPT_COMMAND</A
></DT
><DT
>4.2. <A
HREF="x279.html"
>External Commands in the Prompt</A
></DT
><DT
>4.3. <A
HREF="x295.html"
>What to Put in Your Prompt</A
></DT
></DL
></DD
><DT
>5. <A
HREF="saving-complex-prompts.html"
>Saving Complex Prompts</A
></DT
><DT
>6. <A
HREF="c327.html"
>ANSI Escape Sequences: Colours and Cursor Movement</A
></DT
><DD
><DL
><DT
>6.1. <A
HREF="x329.html"
>Colours</A
></DT
><DT
>6.2. <A
HREF="x361.html"
>Cursor Movement</A
></DT
><DT
>6.3. <A
HREF="xterm-title-bar-manipulations.html"
>Xterm Title Bar Manipulations</A
></DT
><DT
>6.4. <A
HREF="x395.html"
>Xterm Title Bars and Screen</A
></DT
><DT
>6.5. <A
HREF="x405.html"
>Colours and Cursor Movement With <B
CLASS="COMMAND"
>tput</B
></A
></DT
></DL
></DD
><DT
>7. <A
HREF="c583.html"
>Special Characters: Octal Escape Sequences</A
></DT
><DT
>8. <A
HREF="the-bash-prompt-package.html"
>The Bash Prompt Package</A
></DT
><DD
><DL
><DT
>8.1. <A
HREF="x592.html"
>Availability</A
></DT
><DT
>8.2. <A
HREF="x598.html"
>Xterm Fonts</A
></DT
><DT
>8.3. <A
HREF="x606.html"
>Changing the Xterm Font</A
></DT
><DT
>8.4. <A
HREF="x622.html"
>Line Draw Characters without VGA Fonts</A
></DT
></DL
></DD
><DT
>9. <A
HREF="c641.html"
>Loading a Different Prompt</A
></DT
><DD
><DL
><DT
>9.1. <A
HREF="x643.html"
>Loading a Different Prompt, Later</A
></DT
><DT
>9.2. <A
HREF="x655.html"
>Loading a Different Prompt, Immediately</A
></DT
><DT
>9.3. <A
HREF="x664.html"
>Loading Different Prompts in Different X Terms</A
></DT
></DL
></DD
><DT
>10. <A
HREF="c670.html"
>Loading Prompt Colours Dynamically</A
></DT
><DD
><DL
><DT
>10.1. <A
HREF="x672.html"
>A "Proof of Concept" Example</A
></DT
></DL
></DD
><DT
>11. <A
HREF="c679.html"
>Prompt Code Snippets</A
></DT
><DD
><DL
><DT
>11.1. <A
HREF="x686.html"
>Built-in Escape Sequences</A
></DT
><DT
>11.2. <A
HREF="x690.html"
>Date and Time</A
></DT
><DT
>11.3. <A
HREF="x700.html"
>Counting Files in the Current Directory</A
></DT
><DT
>11.4. <A
HREF="x711.html"
>Total Bytes in the Current Directory</A
></DT
><DT
>11.5. <A
HREF="x721.html"
>Checking the Current TTY</A
></DT
><DT
>11.6. <A
HREF="x733.html"
>Stopped Jobs Count</A
></DT
><DT
>11.7. <A
HREF="x746.html"
>Load</A
></DT
><DT
>11.8. <A
HREF="x758.html"
>Uptime</A
></DT
><DT
>11.9. <A
HREF="x771.html"
>Number of Processes</A
></DT
><DT
>11.10. <A
HREF="x783.html"
>Controlling the Size and Appearance of $PWD</A
></DT
><DT
>11.11. <A
HREF="x794.html"
>Laptop Power</A
></DT
><DT
>11.12. <A
HREF="x799.html"
>Having the Prompt Ignored on Cut and Paste</A
></DT
><DT
>11.13. <A
HREF="x806.html"
>New Mail</A
></DT
><DT
>11.14. <A
HREF="x810.html"
>Prompt Beeps After Long-Running Commands</A
></DT
></DL
></DD
><DT
>12. <A
HREF="c816.html"
>Example Prompts</A
></DT
><DD
><DL
><DT
>12.1. <A
HREF="x818.html"
>Examples on the Web</A
></DT
><DT
>12.2. <A
HREF="x822.html"
>A "Lightweight" Prompt</A
></DT
><DT
>12.3. <A
HREF="x834.html"
>Dan's Prompt</A
></DT
><DT
>12.4. <A
HREF="x847.html"
>Elite from Bashprompt Themes</A
></DT
><DT
>12.5. <A
HREF="x860.html"
>A "Power User" Prompt</A
></DT
><DT
>12.6. <A
HREF="x865.html"
>Prompt Depending on Connection Type</A
></DT
><DT
>12.7. <A
HREF="x869.html"
>A Prompt the Width of Your Term</A
></DT
><DT
>12.8. <A
HREF="clockt.html"
>The Floating Clock Prompt</A
></DT
><DT
>12.9. <A
HREF="the-elegant-useless-clock-prompt.html"
>The Elegant Useless Clock Prompt</A
></DT
></DL
></DD
><DT
>A. <A
HREF="gfdl.html"
>GNU Free Documentation License</A
></DT
><DD
><DL
><DT
>0. <A
HREF="x907.html"
>PREAMBLE</A
></DT
><DT
>1. <A
HREF="x912.html"
>APPLICABILITY AND DEFINITIONS</A
></DT
><DT
>2. <A
HREF="x922.html"
>VERBATIM COPYING</A
></DT
><DT
>3. <A
HREF="x926.html"
>COPYING IN QUANTITY</A
></DT
><DT
>4. <A
HREF="x932.html"
>MODIFICATIONS</A
></DT
><DT
>5. <A
HREF="x968.html"
>COMBINING DOCUMENTS</A
></DT
><DT
>6. <A
HREF="x973.html"
>COLLECTIONS OF DOCUMENTS</A
></DT
><DT
>7. <A
HREF="x977.html"
>AGGREGATION WITH INDEPENDENT WORKS</A
></DT
><DT
>8. <A
HREF="x981.html"
>TRANSLATION</A
></DT
><DT
>9. <A
HREF="x984.html"
>TERMINATION</A
></DT
><DT
>10. <A
HREF="x987.html"
>FUTURE REVISIONS OF THIS LICENSE</A
></DT
><DT
><A
HREF="x992.html"
>How to use this License for your documents</A
></DT
></DL
></DD
></DL
></DIV
></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"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="c23.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Introduction and Administrivia</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>