\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{¦p¦óÅÜ§ó xterm ªº¥DÃD}
\author{Ric Lister, {\ttfamily ric@giccs.georgetown.edu}\\ 
Ä¶ªÌ: ´¿¤¸¦ö {\ttfamily \onlynameurl{yytseng@ms16.hinet.net}}}
\date{v2.0, 1999 ¦~¤Q¤ë 27 ¤é}
\abstract{¥»¤å¸ÑÄÀ¦p¦ó¨Ï¥Î·¸¦ì§Ç¦C¥H°ÊºAÅÜ§ó xterm ªºµøµ¡¤Î¹Ï¥Ü.
½d¨Ò¤¤, ¥]§t¼ÆºØ©R¥O¸ÑÄ¶¾¹»yªk. ¦Óªþ¿ý¥ç¦C¥Xµ¹¨ä¥LÃþ«¬²×ºÝ¾÷¨Ï¥Îªº·¸¦ì§Ç¦C.}


\begin{document}
\maketitle
\tableofcontents

\section{¥i¥H¦b­þ§ä¨ì³o¥÷¤å¥ó}

³o¥÷¤å¥ó²{¤w¬O 
\nameurl{http://sunsite.unc.edu/LDP/HOWTO/}{Linux HOWTO Index}
ªº¤@³¡¥÷, ¥ç¥i¥H¦b³o§ä¨ì 
\nameurl{http://sunsite.unc.edu/LDP/HOWTO/mini/Xterm-Title.html}{}.



³Ì·sª©¥»ªº¦UºØ¤å¥ó®æ¦¡³£¥i¥H¦b³o§ä¨ì 
\nameurl{http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/}{}.



¥»¤å¨ú¥N¤F­ì¥»¥Ñ Winfried Tr\"umper ©Ò¼gªº howto.






\section{ÀRºA¥DÃD}

¥ô¤@ºØ²×ºÝ¾÷ {\ttfamily xterm},
{\ttfamily color-xterm} ©Î {\ttfamily rxvt} ³£¥i¥HÂÇ¥Ñ {\ttfamily -T} ¤Î {\ttfamily -n}
ªº°Ñ¼Æ³]©w¨Ó³]©wÀRºA¥DÃD:
\begin{tscreen}
xterm -T "My XTerm's Title" -n "My XTerm's Icon Title"
\end{tscreen}







\section{°ÊºA¥DÃD}

³\¦h¤Hµo²{³o¦bÅã¥Ü¤@¨Ç°ÊºA¸ê°T®É¬Û·í¦³¥Î, ¤ñ¦p ¨Ï¥ÎªÌ©Òµn¤Jªº¥D¾÷¦WºÙ,
²{¦æªº¤u§@¥Ø¿ý, µ¥µ¥.






\subsection{xterm ·¸¦ì§Ç¦C}

¤@­Ó¤w¦b°õ¦æªº xterm ªºµøµ¡¤Î¹Ï¥Üªº¥DÃD³£¥i¥H³z¹L·¸¦ì§Ç¦C¨ÓÅÜ§ó.
¤U¦C¦C¥X¸ò³o­Ó³]©w¦³Ãöªº§Ç¦C:
\begin{itemize}
\item {\ttfamily ESC]0;{\bfseries string}BEL} -- ³]©w¹Ï¥Ü¤Îµøµ¡ªº¥DÃD¬°
{\bfseries string}
\item {\ttfamily ESC]1;{\bfseries string}BEL} -- ³]©w¹Ï¥Ü¦W¬° {\bfseries string}
\item {\ttfamily ESC]2;{\bfseries string}BEL} -- ³]©wµøµ¡¥DÃD¬°
{\bfseries string}
\end{itemize}

¦b³o¸Ì {\ttfamily ESC} ¬O«ü {\bfseries escape} ¦r¤¸ ($\backslash$033), ¦Ó{\ttfamily BEL} ¬O«ü
{\bfseries bell} ¦r¤¸ ($\backslash$007).



¦b xterm ¸ÌÀY´N¥i¥H¨Ï±oµøµ¡¤Î¹Ï¥Üªº¥DÃDÅÜ§ó.



{\bfseries ª`·N}: ³o¨Ç§Ç¦C¥i¥HÀ³¥Î¨ì¤j³¡¥÷ xterm ­l¥Íªºµ{¦¡,
¤ñ¦p {\ttfamily nxterm}, {\ttfamily color-xterm} ¤Î {\ttfamily rxvt}. ¨ä¥Lªº
²×ºÝ¾÷Ãþ«¬¤j³£¨Ï¥Î¤£¤@¼Ëªº§Ç¦C; °Ñ¦Òªþ¿ý©Ò¦CÁ|ªº½d¨Ò.
¦p­n°Ñ¦Ò xterm ©Ò¦³ªº·¸¦ì§Ç¦C°Ñ¦Ò³o­ÓÀÉ®×
\nameurl{http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/ctlseq2.txt}{ctlseq2.txt},
³o·|ÀHµÛ xterm ªº®M¥óµo¦æ, ©Î
\nameurl{http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/xterm.seq}{xterm.seq}, ÀHµÛ
\nameurl{http://www.rxvt.org/}{rxvt} ®M¥óµo¦æ.






\subsection{¦L¥X³o¨Ç§Ç¦C}

¦³¨Ç¸ê°T¦b©R¥O¸ÑÄ¶¾¹ªº¥Í©R¶g´Á¤¤¬O¦Û©l¦Ü²×³£¤£ÅÜªº,
¤ñ¦p ¥D¾÷¦WºÙ ¤Î ¨Ï¥ÎªÌ¦WºÙ, ¨º»ò¦b©R¥O¸ÑÄ¶¾¹ªºªì©l±Ò°ÊÀÉ
(rc file) ¥Î echo «ü¥O¦L¥X³o¨Ç¦r¦ê´N°÷¤F:
\begin{tscreen}
\begin{verbatim}
echo -n "\033]0;${USER}@${HOST}\007"
\end{verbatim}
\end{tscreen}

À³¸Ó·|²£¥Í¹³ {\ttfamily username@hostname} ³o¼Ëªº¥DÃD,
°²³]©R¥O¸ÑÄ¶¾¹ªºÅÜ¼Æ {\ttfamily \$USER} ¤Î {\ttfamily \$HOST} ³£¤w³]©w¥¿½Tªº¸Ü.
{\ttfamily echo} ©Ò»Ýªº¿ï¶µ¨Ì©R¥O¸ÑÄ¶¾¹¨Ï¥ÎªºÃþ«¬¦Ó¦³©Ò¤£¦P (°Ñ¦Ò¤U­±ªº»¡©ú).



¦³¨Ç¸ê°T¦b©R¥O¸ÑÄ¶¾¹ªº¥Í©R¶g´Á¤¤¬O¤@ª½¦bÅÜªº,
¤ñ¦p ²{¦æ¤u§@¥Ø¿ý, ³o¨Ç·¸¦ì¸ê°T´N¥²¶·¦b¨C¦¸´£¥Ü¦r¤¸ÅÜ¤Æ®ÉÀHµÛ§ïÅÜ. 
³o¤U¤l¦r¦ê´N·|¦b¨C¦¸§A¿é¤J©R¥O®É§ó·s,
¦Ó¥B§AÁÙ¥i¥H°lÂÜ«O¯d ²{¦æ¥Ø¿ý, ¨Ï¥ÎªÌ¦W, ¥D¾÷¦W, µ¥¸ê°T.
³¡¥÷©R¥O¸ÑÄ¶¾¹´£¨Ñ³oÃþ¥Î³~ªº¯S®í¥\¯à,
¦³¨Ç«h¨S¦³. ¦Ó§Ú­Ì´N¥²¶·ª½±µ´¡¤J¥DÃD·¸¦ì¸ê°T¨ìÃD¥Ü¦r¦ê¤¤.
³o·|¦b¤U¤@¸`¤¤»¡©ú






\section{¦UºØ©R¥O¸ÑÄ¶¾¹ªº½d¨Ò}

¥H¤U§Ú­Ì´£¥\¤@¨Ç½d¨Òµ¹±`¨£ªº©R¥O¸ÑÄ¶¾¹¨Ï¥Î.
§Ú­Ì¥ý±q {\ttfamily zsh} ¶}©l,
¥L¥i¥H´£¨Ñ³\¦hÆF¥©ªº¾÷¨î¨Ï±o§Ú­Ì«Ü®e©ö¦a§¹¦¨§Ú­Ì©Ò­nªº¤u§@.
µM«á§Ú­Ì¦A¶i®i¨ìÃø«×¸û°ªªº½d¨Ò.



¦b©Ò¦³ªº½d¨Ò¤¤§Ú­Ì³£´ú¸Õ¤F {\ttfamily \$TERM} Àô¹ÒÅÜ¼Æ.
¥H½T©w§Ú­Ì¥u»Ý§â³o­Ó·¸¦ì¸ê°T°e¨ì xterm. §Ú­Ì¹ï
{\ttfamily \$TERM=xterm*} °µ´ú¸Õ; ¸U¥Î¦r¤¸¬O¦]¬°¨Ç³\ªº®t²§©Ê
(¤ñ¦p rxvt) ·|³]©w {\ttfamily \$TERM=xterm-color}.



§Ú­Ì­n¹ï C ©R¥O¸ÑÄ¶¾¹ (C Shell) ±Ú¨t§@¯S§Oªºµù¸Ñ, ¤ñ¦p
{\ttfamily tcsh} ¤Î {\ttfamily csh}.
¦b C ©R¥O¸ÑÄ¶¾¹, ¨Ï¥Î¨ì¥¼©w¸qªºÅÜ¼Æ´Nºâ¬O­P©R©Êªº¿ù»~.
¦]¦¹, ¦b´ú¸ÕÅÜ¼Æ {\ttfamily \$TERM} ¤§«e,
¥ý½T©w¨ä¬O§_¦s¦b§_«h·|¨Ï¦b«D¥æ½Í¼Ò¦¡¤U¤u§@ªº©R¥O¸ÑÄ¶¾¹°±Â\.
­n¹F¨ì³o­Ó¥Øªº§A¥²¶·§â³¡¥÷ªF¦è¥Î¤U­±³oºØ¼Ë¦¡¥]°_¨Ó:
\begin{tscreen}
\begin{verbatim}
  if ($?TERM) then
      ...
  endif
\end{verbatim}
\end{tscreen}

(§Ú­Ì¬O¤£¥D±i¥Î C ©R¥O¸ÑÄ¶¾¹ ªº²z¥Ñ¤§¤@. °Ñ¦Ò
{\itshape \nameurl{http://language.perl.com/versus/csh.whynot}{Csh Programming Considered Harmful}\/} ¦³«Ü¦h¦³¥Îªº°Q½×¤å³¹).



¥H¤Uªº½d¨Ò¥i¥H³Q¥Î¨Ó´¡¤J¨ì¦X¾Aªº©R¥O¸ÑÄ¶¾¹ªºªì©l±Ò°ÊÀÉ;
§Y ¨º­Ó¦b¥æ½Í¦¡©R¥O¸ÑÄ¶¾¹±Ò°Ê®É·|¥hÅªªº¨º­ÓÀÉ.
¦b¤j³¡¥÷ªº±¡ªp¥¦³QºÙ¬°
{\ttfamily .{\itshape ©R¥O¸ÑÄ¶¾¹¦W\/}rc} (¦p {\ttfamily .zshrc}, {\ttfamily .tcshrc}, µ¥).








\subsection{zsh}

{\ttfamily zsh} ´£¨Ñ³¡¥÷¥\¯à»P©µ¦ù¥\¯à, ¦Ó§Ú­Ì±N¥Î¨ì:
\begin{tscreen}
\begin{verbatim}
precmd ()   ¤@­Ó¦b´£¥Ü©R¥O«e¥²°õ¦æªº¥\¯à§t¦¡
chpwd ()    ¤@­Ó¦b¥Ø¿ý¦³©ÒÅÜ¤Æ®É·|°õ¦æªº¥\¯à§t¦¡
\e          ·¸¦ì¦r¤¸ (ESC)
\a          bell ªº·¸¦ì¦r¤¸ (BEL)
%n          ³Q¸ÑÄÀ¬° $USERNAME
%m          ³Q¸ÑÄÀ¬°¥D¾÷¦WºÙ¦b²Ä¤@­Ó '.' ¤§«eªº³¡¥÷
%~          ³Q¸ÑÄÀ¬°¥Ø¿ý, ¥H '~' ¨ú¥N $HOME
\end{verbatim}
\end{tscreen}

§ó¦hªº©µ¦ù¥\¯à: °Ñ¦Ò {\ttfamily zshmisc} ¨Ï¥Î¤â¥U.



¦]¦¹, ¥H¤U±N³]©w xterm ªº¥DÃD¬°
"{\ttfamily {\itshape username\/}@{\itshape hostname\/}: {\itshape directory\/}}":
\begin{tscreen}
\begin{verbatim}
case $TERM in
    xterm*)
        precmd () {print -Pn "\e]0;%n@%m: %~\a"}
        ;;
esac
\end{verbatim}
\end{tscreen}

³o¤]¥i¥H¥Î {\ttfamily chpwd()} ¨ú¥N
{\ttfamily precmd()} ¨Ó¹F¦¨. {\ttfamily print} ¤º«Øªº¤u§@¬O¸ò
{\ttfamily echo} ¤@¼Ë, ¦ý¥i¥HÅý§Ú­Ì¥h¦s¨ú {\ttfamily \%} ©R¥O´£¥Ü·¸¦ì¸ê°T.






\subsection{tcsh}

{\ttfamily tcsh} ªº³¡¥÷¥\¯à§t¦¡»P©µ¦ù¥\¯à»P {\ttfamily zsh} ¬Û¦P:
\begin{tscreen}
\begin{verbatim}
precmd ()   ¤@­Ó¦b´£¥Ü©R¥O«e¥²°õ¦æªº¥\¯à§t¦¡
cwdcmd ()   ¤@­Ó¦b¥Ø¿ý¦³©ÒÅÜ¤Æ®É·|°õ¦æªº¥\¯à§t¦¡
%n          ³Q¸ÑÄÀ¬° $USERNAME
%m          ³Q¸ÑÄÀ¬°¥D¾÷¦WºÙ
%~          ³Q¸ÑÄÀ¬°¥Ø¿ý, ¥H '~' ¨ú¥N $HOME
%#          ¹ï¥¿±`ªº¨Ï¥ÎªÌ¸ÑÄÀ¬° '>', ¦Ó¶W¯Å¨Ï¥ÎªÌ«h¬° '#'
%{...%}     ¤Þ¤J¤@­Ó¦r¦ê¬°³sÄòªº·¸¦ì§Ç¦C
\end{verbatim}
\end{tscreen}




¤£©¯ªº, ¨Ã¨S¦³»P {\ttfamily zsh} ªº {\ttfamily print} ¬Û¦P¥\¯àªº«ü¥O,
¯àÅý§Ú­Ì¦b¥DÃD¦r¦ê¤¤¨Ï¥Î´£¥Ü·¸¦ì¸ê°T,
¦]¦¹§Ú­Ì°ß¤@¯à¨Ï¥Îªº©R¥O¸ÑÄ¶¾¹ÅÜ¼Æ (¦b {\ttfamily \~{}/.tcshrc}):
\begin{tscreen}
\begin{verbatim}
switch ($TERM)
    case "xterm*":
        alias precmd 'echo -n "\033]0;${HOST}:$cwd\007"'
        breaksw
endsw
\end{verbatim}
\end{tscreen}

µM¦Ó, ³o·|¥Î¥Ø¿ý§¹¾ãªº¸ô®|¨ú¥N¨Ï¥Î {\ttfamily \~{}}.
§ï§â³o¨Ç¦r¦ê´¡¤JÃD¥Ü¦r¤¸:
\begin{tscreen}
\begin{verbatim}
switch ($TERM)
    case "xterm*":
        set prompt="%{\033]0;%n@%m:%~\007%}tcsh%# "
        breaksw
    default:
        set prompt="tcsh%# "
        breaksw
endsw
\end{verbatim}
\end{tscreen}

³o·|³]©w "{\ttfamily tcsh\% }" ªº´£¥Ü¦r¤¸, ¦Ó xterm ªº¥DÃD¤Î¹Ï¥Ü¬°
"{\ttfamily {\itshape username\/}@{\itshape hostname\/}: {\itshape directory\/}}". ­nª`·N
"{\ttfamily \%$\{$...\%$\}$}" ¥²¶·ÀôÂ¶¦b·¸¦ì§Ç¦C¥~
(¥B¤£¯à³Q©ñ¦b ´£¥Üªº³Ì«á¤@¶µ: °Ñ¦Ò {\ttfamily tcsh} ¨Ï¥Î¤â¥U»¡©ú·|§ó¸Ô²Ó).






\subsection{bash}

{\ttfamily bash} ¤ä´©ÅÜ¼Æ {\ttfamily \$PROMPT\_COMMAND}
¤º§t¤@­Ó«ü¥O¦b´£¥Ü¦r¤¸¤§«e°õ¦æ. ³o­Ó½d¨Ò±N³]©w¥DÃD¬°
{\ttfamily username@hostname: directory}:
\begin{tscreen}
\begin{verbatim}
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
\end{verbatim}
\end{tscreen}

¦b³oªº {\ttfamily $\backslash$033} ¬O¥Nªí¦r¤¸ {\ttfamily ESC},
¦Ó {\ttfamily $\backslash$007} «h¬O {\ttfamily BEL}.



°O¦í¤Þ¸¹¦b³o¬Û·í­«­n: ·|³Q¸ÑÄÀªºÅÜ¼Æ¬O©ñ¦b
{\ttfamily "..."}, ¦Ó¤£¬O {\ttfamily '...'}. ¦]¦¹
{\ttfamily \$PROMPT\_COMMAND} ¬O³Q³]©w¬°¤@­Ó¤£³Q¸ÑÄÀªº­È,
¦ýÅÜ¼Æ¦b {\ttfamily "..."} ùØ¦pªG¦³¥Î¨ì {\ttfamily \$PROMPT\_COMMAND} «h·|³Q¸ÑÄÀ.



µM¦Ó, {\ttfamily \$PWD} ²£¥Í§¹¾ãªº¸ô®|.
¦pªG§Ú­Ì­n¨Ï¥Î {\ttfamily \~{}} ³oºØ³t°O, «h§Ú­Ì­n§â·¸¦ì¦r¦ê´O¤J¨ì´£¥Ü¦r¤¸,
³o·|Åý§Ú­Ì¥i¥H§Q¥Î©R¥O¸ÑÄ¶¾¹©Ò´£¨Ñªº©R¥O¦C©µ¦ù¥\¯à:
\begin{tscreen}
\begin{verbatim}
\u          ³Q¸ÑÄÀ¬° $USERNAME
\h          ³Q¸ÑÄÀ¬°¥D¾÷¦WºÙ¦b²Ä¤@­Ó '.' ¤§«eªº³¡¥÷
\w          ³Q¸ÑÄÀ¬°¥Ø¿ý, ¥H '~' ¨ú¥N $HOME
\$          ¹ï¥¿±`ªº¨Ï¥ÎªÌ¸ÑÄÀ¬° '>', ¦Ó¶W¯Å¨Ï¥ÎªÌ«h¬° '#'
\[...\]     ´O¤J«D¦C¦L¦r¤¸·¸¦ì§Ç¦C
\end{verbatim}
\end{tscreen}




¦]¦¹, ¥H¤U±N²£¥Í {\ttfamily bash\$} ªº´£¥Ü¦r¤¸,
¨Ã³]©w xterm ªº¥DÃD¬° {\ttfamily username@hostname: directory}:
\begin{tscreen}
\begin{verbatim}
case $TERM in
    xterm*)
        PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
        ;;
    *)
        PS1="bash\\$ "
        ;;
esac
\end{verbatim}
\end{tscreen}

°O¦í {\ttfamily $\backslash$[...$\backslash$]} ªº¨Ï¥Î, ¦b­pºâÃD¥Üªø«×®É,
±N§i¶D {\ttfamily bash} ©¿²¤±¼«D¦C¦Lªº±±¨î¦r¤¸.
§_«h¦æ½s¿è«ü¥O±N·|¦b²¾°Ê´å¼Ð®É·d¶Ã±¼.






\subsection{ksh}

{\ttfamily ksh} ´X¥G¤£´£¨Ñ³oºØ¤è¦¡ªº¥\¯à¨ç¦¡»P©µ¦ù¥\¯à,
¦]¦¹§Ú­Ì¥²¶·´¡¤J·¸¦ì¦r¦ê¨ì´£¥Ü¦r¤¸¤¤, ¨Ï¥L¯à°ÊºA§ó·s
³o­Ó½d¨Ò±N²£¥Í¥DÃD¬°
{\ttfamily username@hostname: directory} ¦Óand a prompt of {\ttfamily ksh\$ }.
\begin{tscreen}
\begin{verbatim}
case $TERM in
    xterm*)
        HOST=`hostname`
        PS1='^[]0;${USER}@${HOST}: ${PWD}^Gksh$ '
        ;;
    *)
        PS1='ksh$ '
        ;;
esac
\end{verbatim}
\end{tscreen}

¦Ó, {\ttfamily \$PWD} ·|²£¥Í§¹¾ãªº¥Ø¿ý¸ô®|. §Ú­Ì¥i¥H
¥Î {\ttfamily \$$\{$...\#\#...$\}$} ªº¤è¦¡²¾¥h {\ttfamily \$HOME/} ªº¦r­º.
§Ú­Ì¤]¥i¥H¥Î {\ttfamily \$$\{$...\%\%...$\}$} ªº¤èªk¨ÓºI¥h³¡¥÷ªº hostname:
\begin{tscreen}
\begin{verbatim}
HOST=`hostname`
HOST=${HOST%%.*}
PS1='^[]0;${USER}@${HOST}: ${PWD##${HOME}/}^Gksh$ '
\end{verbatim}
\end{tscreen}

°O¦í {\ttfamily \^{}[} ¤Î {\ttfamily \^{}G} ¦b©R¥O¦C¦r¦ê¬O³æ¤@¦r¤¸
ªº {\ttfamily ESC} ¤Î {\ttfamily BEL} (¦b emacs ªºÀô¹Ò¤U¥i¥H¥Î
{\ttfamily C-q ESC} ¤Î {\ttfamily C-q C-g} ¿é¤J).






\subsection{csh}

­n¦b {\ttfamily csh} §¹¦¨¦P¼Ëªº¨Æ¯uªº¦³ÂI§xÃø, ¦Ó§Ú­Ì¥Î¤U­±ªº¤è¦¡¨Ó¸Ñ¨M°ÝÃD:
\begin{tscreen}
\begin{verbatim}
switch ($TERM)
    case "xterm*":
        set host=`hostname`
        alias cd 'cd \!*; echo -n "^[]0;${user}@${host}: ${cwd}^Gcsh% "'
        breaksw
    default:
        set prompt='csh% '
        breaksw
endsw
\end{verbatim}
\end{tscreen}

³Â·Ðªº¦a¤è¬O§Ú­Ì­n§â {\ttfamily cd} ³o­Ó«ü¥O¤Æ¨­¦¨¥i°e¥X·¸¦ì¦r¦êªº¥\¯à.
°O¦í {\ttfamily \^{}[} ¤Î {\ttfamily \^{}G} ¦b©R¥O¦C¦r¦ê¬O³æ¤@¦r¤¸ªº
{\ttfamily ESC} ¤Î {\ttfamily BEL} (¦b emacs ªºÀô¹Ò¤U¥i¥H¥Î
{\ttfamily C-q ESC} ¤Î {\ttfamily C-q C-g} ¿é¤J).



°O¦í: ¦b³¡¥÷ªº¨t²Î {\ttfamily hostname -s} ¥i¯à·|¨ú±o¸ûµuªº
hostname ¦Ó¤£¬O§¹¾ãªº¥þ¦W. ³¡¥÷¨Ï¥ÎªÌ¦b¦³²Å¸¹³sµ²ªº¥Ø¿ýÀ³¸Ó·|µo²{
{\ttfamily `pwd`} (¬A°_¨Ó¥H½T©w°õ¦æªº¬O {\ttfamily pwd} «ü¥O)
¥i¥H±o¨ì¤ñ {\ttfamily \$cwd} §óºë½Tªº¸ô®|¦W.








\section{Åã¥Ü¥¿¦b°õ¦æªº¤u§@¦WºÙ}

³q±`¨Ï¥ÎªÌ·|±Ò°Ê¤@­Ó¤@ª½¦b«e´º°õ¦æªº¤u§@¦p {\ttfamily top}, ©Î
¤@­Ó½s¿è¾¹, ¤@­Ó email ¥Î¤áºÝ, µ¥µ¥, ¨Ã§Æ±æ³o­Ó¤u§@ªº¦WºÙ³QÅã¥Ü¦b
xterm ªº¥DÃD¤W. ³o¬O­Ó«Ü´Æ¤âªº°ÝÃD¥B¥u¯à¦b {\ttfamily zsh} Àô¹Ò¤U¥i¥H»´ÃP§¹¦¨.




\subsection{zsh}

{\ttfamily zsh} ¬°³oºØ»Ý¨D´£¨Ñ¤F¤@­Ó«Ü²z·Qªº¤º«Ø¥\¯à:
\begin{tscreen}
\begin{verbatim}
preexec()   ¤@­Ó¦b©R¥O°õ¦æ«e¤@©w·|¥s¥Îªº¥\¯à¨ç¦¡¦W
$*,$1,...   ¶Ç°e¨ì preexec() ªº°Ñ¼Æ
\end{verbatim}
\end{tscreen}

¦]¦¹, §Ú­Ì¥i¥H¥Î¤U­±ªº¤è¦¡§â¤u§@¦WºÙ©ñ¨ì¥DÃD¤W:
\begin{tscreen}
\begin{verbatim}
case $TERM in
    xterm*)
      preexec () {
        print -Pn "\e]0;$*\a"
      }
    ;;
esac
\end{verbatim}
\end{tscreen}

°O¦í: {\ttfamily preexec()} ¥\¯à¨ç¦¡¦b {\ttfamily zsh} 3.1.2 ª©¥X²{,
¦pªG§A¥Îªºª©¥»¸ûÂÂ¨º´N»Ý­n§ó·s¤@¤U.






\subsection{¨ä¥L©R¥O¸ÑÄ¶¾¹s}

¹ï¨ä¥¦¯Ê¤Ö {\ttfamily preexec()} ¨ç¦¡ªº©R¥O¸ÑÄ¶¾¹, ´N¤£¬O¨º»òÂ²³æ¤F.
¦pªG¥ô¦ó¤H¦³½d¨Ò¥i¥H§¹¦¨¦P¼Ëªº¤u§@½Ð§â¥¦ email µ¹§@ªÌ.






\section{ªþ¿ý: ¨ä¥¦«¬¦¡²×ºÝ¾÷ªº·¸¦ì§Ç¦C}

³\¦h·s¦¡ªº²×ºÝ¾÷³£­l¥Í¦Û {\ttfamily xterm} ©Î {\ttfamily rxvt}
¨Ã¥B¤ä´©§Ú­Ì©Ò¨Ï¥Îªº·¸¦ì§Ç¦C. ¬Y¨Ç±M§Qªº²×ºÝ¾÷ÀHµÛ¦UºØ¤£¦Pªº unix
³c½æ«h·|¨Ï¥Î¥L­Ì¦r­qªº·¸¦ì§Ç¦C.






\subsection{IBM {\ttfamily aixterm}}

{\ttfamily aixterm} ¥i¥H¿ëÃÑ¥X {\ttfamily xterm ªº·¸¦ì§Ç¦C}.






\subsection{SGI {\ttfamily wsh}, {\ttfamily xwsh} ¤Î {\ttfamily winterm}}

³oÃþ²×ºÝ¾÷·|³]©w {\ttfamily \$TERM=iris-ansi} ¨Ã±Ä¥Î¤U¦Cªº·¸¦ì§Ç¦C:
\begin{itemize}
\item {\ttfamily ESCP1.y{\itshape string\/}ESC$\backslash$        ³]©wµøµ¡¥DÃD¬° {\itshape string\/}}
\item {\ttfamily ESCP3.y{\itshape string\/}ESC$\backslash$        ³]©w¹Ï¥Ü¥DÃD¬° {\itshape string\/}}
\end{itemize}

¦Ó {\ttfamily xwsh} §¹¾ãªº·¸¦ì§Ç¦C¥i¥H°Ñ¦Ò {\ttfamily xwsh(1G)} ªº¨Ï¥Î»¡©ú.



Irix ªº²×ºÝ¾÷¤ä´© {\ttfamily xterm} ¦U§O³]©wµøµ¡»P¹Ï¥Ü¥DÃDªº¥\¯à,
¦ý¤£¯à¨âªÌ³£³]©w.






\subsection{Sun {\ttfamily cmdtool} ¤Î {\ttfamily shelltool}}

{\ttfamily cmdtool} ¤Î {\ttfamily shelltool} ·|³]©w {\ttfamily \$TERM=sun-cmd} 
¨Ã±Ä¥Î¤U¦Cªº·¸¦ì§Ç¦C:
\begin{itemize}
\item {\ttfamily ESC]l{\itshape string\/}ESC$\backslash$    ³]©wµøµ¡¥DÃD¬° {\itshape string\/}}
\item {\ttfamily ESC]L{\itshape string\/}ESC$\backslash$    ³]©w¹Ï¥Ü¥DÃD¬° {\itshape string\/}}
\end{itemize}

³o¨Ç¯uªº¬O«Ü¥i©Èªºµ{¦¡: ºÉ¶q§O¨Ï¥Î.






\subsection{CDE {\ttfamily dtterm}}

{\ttfamily dtterm} ·|³]©w {\ttfamily \$TERM=dtterm}, ¦ü¥G¬O¥i¥HÃÑ§O¥X¼Ð·Çªº
{\ttfamily xterm} ·¸¦ì§Ç¦C¤Î Sun {\ttfamily cmdtool} ªº·¸¦ì§Ç¦C
(¦b Solaris 2.5.1, Digital Unix 4.0, HP-UX 10.20 ´ú¸Õ¹L).






\subsection{HPterm}

{\ttfamily hpterm} ·|³]©w {\ttfamily \$TERM=hpterm} ¨Ã±Ä¥Î¤U¦Cªº·¸¦ì§Ç¦C:
\begin{itemize}
\item {\ttfamily ESC\&f0k{\itshape length\/}D{\itshape string\/}   ³]©wµøµ¡¥DÃD¬°ªø {\itshape length\/} ªº {\itshape string\/}}
\item {\ttfamily ESC\&f-1k{\itshape length\/}D{\itshape string\/}  ³]©w¹Ï¥Ü¥DÃD¬°ªø {\itshape length\/} ªº {\itshape string\/}}
\end{itemize}




¤@­ÓÂ²³æªº C »y¨¥ªºµ{¦¡¥Î¨Ó­pºâªø«×¨Ã¦^À³¦r¦ê, ¦p¤U:
\begin{tscreen}
\begin{verbatim}
#include <string.h>
int main(int argc, char *argv[])
{
    printf("\033&f0k%dD%s", strlen(argv[1]), argv[1]);
    printf("\033&f-1k%dD%s", strlen(argv[1]), argv[1]);
    return(0);
}
\end{verbatim}
\end{tscreen}




§Ú­Ì¤]¥i¥H¼g¤@­Ó¤pªº©R¥O¸}¥»µ{§Ç, ¥Î {\ttfamily \$$\{$\#string$\}$}
({\ttfamily zsh}, {\ttfamily bash}, {\ttfamily ksh}) ©Î {\ttfamily \$$\{$\%string$\}$}
({\ttfamily tcsh)} ªº©µ¦ù¥\¯à¨Ó§ä¥X¦r¦êªø«×. ¥H¤U¥i¥Î¦b {\ttfamily zsh}:
\begin{tscreen}
\begin{verbatim}
case $TERM in
    hpterm)
        str="\e]0;%n@%m: %~\a"
        precmd () {print -Pn "\e&f0k${#str}D${str}"}
        precmd () {print -Pn "\e&f-1k${#str}D${str}"}
        ;;
esac
\end{verbatim}
\end{tscreen}











\section{ªþ¿ý: ¨ä¥¦»y¨¥ªº½d¨Ò}

¼g¤@­Ó¤pµ{¦¡§Q¥Î {\ttfamily xterm} ªº·¸¦ì¥\¯à§â¶Ç»¼ªº°Ñ¼Æ·í¦¨¥DÃD.
¥H¤U¬O¤@¨Ç½d¨Ò.






\subsection{C}

\begin{tscreen}
\begin{verbatim}
#include <stdio.h>

int main (int argc, char *argv[]) {
  printf("%c]0;%s%c", '\033', argv[1], '\007');
  return(0);
}
\end{verbatim}
\end{tscreen}







\subsection{Perl}

\begin{tscreen}
\begin{verbatim}
#!/usr/bin/perl
print "\033]0;@ARGV\007";
\end{verbatim}
\end{tscreen}









\section{»ÊÁÂCredits}

·PÁÂ¤U¦C½Ñ¦ì´£¨Ñ«ØÄ³, ­×¥¿, ¤Î½d¨Ò¬°¥»¤å¼W¦â¤£¤Ö.



Paul D. Smith {\ttfamily $<$psmith@BayNetworks.COM$>$} ¤Î
Christophe Martin {\ttfamily $<$cmartin@ipnl.in2p3.fr$>$}
¨â¦ì«ü¥X¦b {\ttfamily bash} {\ttfamily \$PROMPT\_COMMAND} ¤¤§Ú¤Þ­zªº¿ù»~³¡¥÷.
¥¿½Tªº¤èªkÅÜ¤Æ {\itshape ¬O\/} °ÊºA®i¶}ªº.



Paul D. Smith {\ttfamily $<$psmith@BayNetworks.COM$>$}
«ØÄ³¦b {\ttfamily bash} ¤¤¨Ï¥Î {\ttfamily $\backslash$[...$\backslash$]}
¥H¾ã¦X¤£¯àÅã¥Üªº¦r¤¸.



Christophe Martin {\ttfamily $<$cmartin@ipnl.in2p3.fr$>$}
´£¨Ñ {\ttfamily ksh} ªº¸Ñ¨M¤èªk.



Keith Turner {\ttfamily $<$keith@silvaco.com$>$}
´£¨Ñµ¹ Sun ªº {\ttfamily cmdtool} ¤Î {\ttfamily shelltool} ¨Ï¥Îªº·¸¦ì§Ç¦C.



Jean-Albert Ferrez {\ttfamily $<$ferrez@dma.epfl.ch$>$}
«ü¥X¦b "{\ttfamily PWD}" ¤Î "{\ttfamily \$PWD}" ¬Û¥Ù¬Þ¤§³B,
¤Î "{\ttfamily $\backslash$}" »P "{\ttfamily $\backslash$$\backslash$}" ªº¥Îªk.



Bob Ellison {\ttfamily $<$papillo@hpellis.fc.hp.com$>$} ¤Î
Jim Searle {\ttfamily $<$jims@broadcom.com$>$} ´ú¸Õ¦b HP-UX ¤Uªº {\ttfamily dtterm}.



Teng-Fong Seak {\ttfamily $<$seak@drfc.cad.cea.fr$>$} «ØÄ³¥Î
{\ttfamily -s} ¿ï¶µ¥H {\ttfamily hostname}, ¨Ï¥Î {\ttfamily `pwd`}, ¥H¤Î
¦b {\ttfamily csh} ¤U¨Ï¥Î {\ttfamily echo} .



Trilia {\ttfamily $<$trilia@nmia.com$>$} «ØÄ³¥[¤J¨ä¥L»y¨¥ªº¥Îªk.



Brian Miller {\ttfamily $<$bmiller@telstra.com.au$>$} ¥[¤J
{\ttfamily hpterm} ªº·¸¦ì§Ç¦C»P½d¨Ò.



Lenny Mastrototaro {\ttfamily $<$lenny@click3x.com$>$} ¸ÑÄÀ
Irix ²×ºÝ¾÷Àô¹Ò¤U, ¦p¦ó¨Ï¥Î xterm ·¸¦ì§Ç¦C. 



Paolo Supino {\ttfamily $<$paolo@init.co.il$>$} «ØÄ³¦b {\ttfamily bash}
©R¥O¦CÃD¥Ü¤U±Ä¥Î {\ttfamily $\backslash$$\backslash$\$}.



\end{document}
