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

184 lines
2.7 KiB
HTML

<HTML
><HEAD
><TITLE
>Having the Prompt Ignored on Cut and Paste</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="Prompt Code Snippets"
HREF="c679.html"><LINK
REL="PREVIOUS"
TITLE="Laptop Power"
HREF="x794.html"><LINK
REL="NEXT"
TITLE="New Mail"
HREF="x806.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="x794.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 11. Prompt Code Snippets</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x806.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN799"
></A
>11.12. Having the Prompt Ignored on Cut and Paste</H1
><P
>This one is weird but cool. Rory Toma <TT
CLASS="EMAIL"
>&#60;<A
HREF="mailto:rory at corp dot webtv dot
net"
>rory at corp dot webtv dot
net</A
>&#62;</TT
> wrote to suggest a prompt like this: <TT
CLASS="USERINPUT"
><B
>: rory@demon
;</B
></TT
> . How is this useful? You can triple click on any previous
command (in Linux,
anyway) to highlight the whole line, then paste that line in front of
another prompt and the stuff between the ":" and the """ is ignored,
like so:&#13;</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>: rory@demon ; uptime
5:15pm up 6 days, 23:04, 2 users, load average: 0.00, 0.00, 0.00
: rory@demon ; : rory@demon ; uptime
5:15pm up 6 days, 23:04, 2 users, load average: 0.00, 0.00, 0.00</PRE
></FONT
></TD
></TR
></TABLE
><P
>The prompt is a no-op, and if your PS2 is set to a space, multiple lines
can be cut and pasted as well.</P
></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="x794.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="x806.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Laptop Power</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c679.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>New Mail</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>