¦p¦óÅܧó xterm ªº¥DÃD Ric Lister, ric@giccs.georgetown.edu ĶªÌ: ´¿¤¸¦ö [1]yytseng@ms16.hinet.net v2.0, 1999 ¦~¤Q¤ë 27 ¤é _________________________________________________________________ ¥»¤å¸ÑÄÀ¦p¦ó¨Ï¥Î·¸¦ì§Ç¦C¥H°ÊºAÅܧó xterm ªºµøµ¡¤Î¹Ï¥Ü. ½d¨Ò¤¤, ¥]§t¼ÆºØ ©R¥O¸ÑĶ¾¹»yªk. ¦Óªþ¿ý¥ç¦C¥Xµ¹¨ä¥LÃþ«¬²×ºÝ¾÷¨Ï¥Îªº·¸¦ì§Ç¦C. _________________________________________________________________ 1. ¥i¥H¦b­þ§ä¨ì³o¥÷¤å¥ó 2. ÀRºA¥DÃD 3. °ÊºA¥DÃD * 3.1 xterm ·¸¦ì§Ç¦C * 3.2 ¦L¥X³o¨Ç§Ç¦C 4. ¦UºØ©R¥O¸ÑĶ¾¹ªº½d¨Ò * 4.1 zsh * 4.2 tcsh * 4.3 bash * 4.4 ksh * 4.5 csh 5. Åã¥Ü¥¿¦b°õ¦æªº¤u§@¦WºÙ * 5.1 zsh * 5.2 ¨ä¥L©R¥O¸ÑĶ¾¹s 6. ªþ¿ý: ¨ä¥¦«¬¦¡²×ºÝ¾÷ªº·¸¦ì§Ç¦C * 6.1 IBM aixterm * 6.2 SGI wsh, xwsh ¤Î winterm * 6.3 Sun cmdtool ¤Î shelltool * 6.4 CDE dtterm * 6.5 HPterm 7. ªþ¿ý: ¨ä¥¦»y¨¥ªº½d¨Ò * 7.1 C * 7.2 Perl 8. »ÊÁÂCredits _________________________________________________________________ 1. ¥i¥H¦b­þ§ä¨ì³o¥÷¤å¥ó ³o¥÷¤å¥ó²{¤w¬O [2]Linux HOWTO Index ªº¤@³¡¥÷, ¥ç¥i¥H¦b³o§ä¨ì [3]http://sunsite.unc.edu/LDP/HOWTO/mini/Xterm-Title.html. ³Ì·sª©¥»ªº¦UºØ¤å¥ó®æ¦¡³£¥i¥H¦b³o§ä¨ì [4]http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/. ¥»¤å¨ú¥N¤F­ì¥»¥Ñ Winfried Trümper ©Ò¼gªº howto. 2. ÀRºA¥DÃD ¥ô¤@ºØ²×ºÝ¾÷ xterm, color-xterm ©Î rxvt ³£¥i¥HÂÇ¥Ñ -T ¤Î -n ªº°Ñ¼Æ³]©w ¨Ó³]©wÀRºA¥DÃD: xterm -T "My XTerm's Title" -n "My XTerm's Icon Title" 3. °ÊºA¥DÃD ³\¦h¤Hµo²{³o¦bÅã¥Ü¤@¨Ç°ÊºA¸ê°T®É¬Û·í¦³¥Î, ¤ñ¦p ¨Ï¥ÎªÌ©Òµn¤Jªº¥D¾÷¦WºÙ, ²{¦æªº¤u§@¥Ø¿ý, µ¥µ¥. 3.1 xterm ·¸¦ì§Ç¦C ¤@­Ó¤w¦b°õ¦æªº xterm ªºµøµ¡¤Î¹Ï¥Üªº¥DÃD³£¥i¥H³z¹L·¸¦ì§Ç¦C¨ÓÅܧó. ¤U¦C¦C ¥X¸ò³o­Ó³]©w¦³Ãöªº§Ç¦C: * ESC]0;stringBEL -- ³]©w¹Ï¥Ü¤Îµøµ¡ªº¥DÃD¬° string * ESC]1;stringBEL -- ³]©w¹Ï¥Ü¦W¬° string * ESC]2;stringBEL -- ³]©wµøµ¡¥DÃD¬° string ¦b³o¸Ì ESC ¬O«ü escape ¦r¤¸ (\033), ¦ÓBEL ¬O«ü bell ¦r¤¸ (\007). ¦b xterm ¸ÌÀY´N¥i¥H¨Ï±oµøµ¡¤Î¹Ï¥Üªº¥DÃDÅܧó. ª`·N: ³o¨Ç§Ç¦C¥i¥HÀ³¥Î¨ì¤j³¡¥÷ xterm ­l¥Íªºµ{¦¡, ¤ñ¦p nxterm, color-xterm ¤Î rxvt. ¨ä¥Lªº ²×ºÝ¾÷Ãþ«¬¤j³£¨Ï¥Î¤£¤@¼Ëªº§Ç¦C; °Ñ¦Òªþ¿ý©Ò ¦CÁ|ªº½d¨Ò. ¦p­n°Ñ¦Ò xterm ©Ò¦³ªº·¸¦ì§Ç¦C°Ñ¦Ò³o­ÓÀÉ®× [5]ctlseq2.txt, ³o·|ÀHµÛ xterm ªº®M¥óµo¦æ, ©Î [6]xterm.seq, ÀHµÛ [7]rxvt ®M¥óµo¦æ. 3.2 ¦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: echo -n "\033]0;${USER}@${HOST}\007" À³¸Ó·|²£¥Í¹³ username@hostname ³o¼Ëªº¥DÃD, °²³]©R¥O¸ÑĶ¾¹ªºÅÜ¼Æ $USER ¤Î $HOST ³£¤w³]©w¥¿½Tªº¸Ü. 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¤@¸`¤¤»¡©ú 4. ¦UºØ©R¥O¸ÑĶ¾¹ªº½d¨Ò ¥H¤U§Ú­Ì´£¥\¤@¨Ç½d¨Òµ¹±`¨£ªº©R¥O¸ÑĶ¾¹¨Ï¥Î. §Ú­Ì¥ý±q zsh ¶}©l, ¥L¥i¥H´£ ¨Ñ³\¦hÆF¥©ªº¾÷¨î¨Ï±o§Ú­Ì«Ü®e©ö¦a§¹¦¨§Ú­Ì©Ò­nªº¤u§@. µM«á§Ú­Ì¦A¶i®i¨ìÃø «×¸û°ªªº½d¨Ò. ¦b©Ò¦³ªº½d¨Ò¤¤§Ú­Ì³£´ú¸Õ¤F $TERM Àô¹ÒÅܼÆ. ¥H½T©w§Ú­Ì¥u»Ý§â³o­Ó·¸¦ì¸ê°T °e¨ì xterm. §Ú­Ì¹ï $TERM=xterm* °µ´ú¸Õ; ¸U¥Î¦r¤¸¬O¦]¬°¨Ç³\ªº®t²§©Ê (¤ñ ¦p rxvt) ·|³]©w $TERM=xterm-color. §Ú­Ì­n¹ï C ©R¥O¸ÑĶ¾¹ (C Shell) ±Ú¨t§@¯S§Oªºµù¸Ñ, ¤ñ¦p tcsh ¤Î csh. ¦b C ©R¥O¸ÑĶ¾¹, ¨Ï¥Î¨ì¥¼©w¸qªºÅܼƴNºâ¬O­P©R©Êªº¿ù»~. ¦]¦¹, ¦b´ú¸ÕÅÜ¼Æ $TERM ¤§«e, ¥ý½T©w¨ä¬O§_¦s¦b§_«h·|¨Ï¦b«D¥æ½Í¼Ò¦¡¤U¤u§@ªº©R¥O¸ÑĶ¾¹°± Â\. ­n¹F¨ì³o­Ó¥Øªº§A¥²¶·§â³¡¥÷ªF¦è¥Î¤U­±³oºØ¼Ë¦¡¥]°_¨Ó: if ($?TERM) then ... endif (§Ú­Ì¬O¤£¥D±i¥Î C ©R¥O¸ÑĶ¾¹ ªº²z¥Ñ¤§¤@. °Ñ¦Ò [8]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ºÙ¬° .©R¥O¸ÑĶ¾¹¦Wrc (¦p .zshrc, .tcshrc, µ¥). 4.1 zsh zsh ´£¨Ñ³¡¥÷¥\¯à»P©µ¦ù¥\¯à, ¦Ó§Ú­Ì±N¥Î¨ì: 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 §ó¦hªº©µ¦ù¥\¯à: °Ñ¦Ò zshmisc ¨Ï¥Î¤â¥U. ¦]¦¹, ¥H¤U±N³]©w xterm ªº¥DÃD¬° "username@hostname: directory": case $TERM in xterm*) precmd () {print -Pn "\e]0;%n@%m: %~\a"} ;; esac ³o¤]¥i¥H¥Î chpwd() ¨ú¥N precmd() ¨Ó¹F¦¨. print ¤º«Øªº¤u§@¬O¸ò echo ¤@ ¼Ë, ¦ý¥i¥HÅý§Ú­Ì¥h¦s¨ú % ©R¥O´£¥Ü·¸¦ì¸ê°T. 4.2 tcsh tcsh ªº³¡¥÷¥\¯à§t¦¡»P©µ¦ù¥\¯à»P zsh ¬Û¦P: 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 ¤£©¯ªº, ¨Ã¨S¦³»P zsh ªº print ¬Û¦P¥\¯àªº«ü¥O, ¯àÅý§Ú­Ì¦b¥DÃD¦r¦ê¤¤¨Ï¥Î ´£¥Ü·¸¦ì¸ê°T, ¦]¦¹§Ú­Ì°ß¤@¯à¨Ï¥Îªº©R¥O¸ÑĶ¾¹ÅÜ¼Æ (¦b ~/.tcshrc): switch ($TERM) case "xterm*": alias precmd 'echo -n "\033]0;${HOST}:$cwd\007"' breaksw endsw µM¦Ó, ³o·|¥Î¥Ø¿ý§¹¾ãªº¸ô®|¨ú¥N¨Ï¥Î ~. §ï§â³o¨Ç¦r¦ê´¡¤JÃD¥Ü¦r¤¸: switch ($TERM) case "xterm*": set prompt="%{\033]0;%n@%m:%~\007%}tcsh%# " breaksw default: set prompt="tcsh%# " breaksw endsw ³o·|³]©w "tcsh% " ªº´£¥Ü¦r¤¸, ¦Ó xterm ªº¥DÃD¤Î¹Ï¥Ü¬° "username@hostname: directory". ­nª`·N "%{...%}" ¥²¶·Àô¶¦b·¸¦ì§Ç¦C¥~ (¥B¤£¯à³Q©ñ¦b ´£¥Üªº³Ì«á¤@¶µ: °Ñ¦Ò tcsh ¨Ï¥Î¤â¥U»¡©ú·|§ó¸Ô²Ó). 4.3 bash bash ¤ä´©ÅÜ¼Æ $PROMPT_COMMAND ¤º§t¤@­Ó«ü¥O¦b´£¥Ü¦r¤¸¤§«e°õ¦æ. ³o­Ó½d¨Ò ±N³]©w¥DÃD¬° username@hostname: directory: PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' ¦b³oªº \033 ¬O¥Nªí¦r¤¸ ESC, ¦Ó \007 «h¬O BEL. °O¦í¤Þ¸¹¦b³o¬Û·í­«­n: ·|³Q¸ÑÄÀªºÅܼƬO©ñ¦b "...", ¦Ó¤£¬O '...'. ¦]¦¹ $PROMPT_COMMAND ¬O³Q³]©w¬°¤@­Ó¤£³Q¸ÑÄÀªº­È, ¦ýÅܼƦb "..." ùئpªG¦³¥Î¨ì $PROMPT_COMMAND «h·|³Q¸ÑÄÀ. µM¦Ó, $PWD ²£¥Í§¹¾ãªº¸ô®|. ¦pªG§Ú­Ì­n¨Ï¥Î ~ ³oºØ³t°O, «h§Ú­Ì­n§â·¸¦ì¦r ¦ê´O¤J¨ì´£¥Ü¦r¤¸, ³o·|Åý§Ú­Ì¥i¥H§Q¥Î©R¥O¸ÑĶ¾¹©Ò´£¨Ñªº©R¥O¦C©µ¦ù¥\¯à: \u ³Q¸ÑÄÀ¬° $USERNAME \h ³Q¸ÑÄÀ¬°¥D¾÷¦WºÙ¦b²Ä¤@­Ó '.' ¤§«eªº³¡¥÷ \w ³Q¸ÑÄÀ¬°¥Ø¿ý, ¥H '~' ¨ú¥N $HOME \$ ¹ï¥¿±`ªº¨Ï¥ÎªÌ¸ÑÄÀ¬° '>', ¦Ó¶W¯Å¨Ï¥ÎªÌ«h¬° '#' \[...\] ´O¤J«D¦C¦L¦r¤¸·¸¦ì§Ç¦C ¦]¦¹, ¥H¤U±N²£¥Í bash$ ªº´£¥Ü¦r¤¸, ¨Ã³]©w xterm ªº¥DÃD¬° username@hostname: directory: case $TERM in xterm*) PS1="\[\033]0;\u@\h: \w\007\]bash\\$ " ;; *) PS1="bash\\$ " ;; esac °O¦í \[...\] ªº¨Ï¥Î, ¦b­pºâÃD¥Üªø«×®É, ±N§i¶D bash ©¿²¤±¼«D¦C¦Lªº±±¨î¦r ¤¸. §_«h¦æ½s¿è«ü¥O±N·|¦b²¾°Ê´å¼Ð®É·d¶Ã±¼. 4.4 ksh ksh ´X¥G¤£´£¨Ñ³oºØ¤è¦¡ªº¥\¯à¨ç¦¡»P©µ¦ù¥\¯à, ¦]¦¹§Ú­Ì¥²¶·´¡¤J·¸¦ì¦r¦ê¨ì ´£¥Ü¦r¤¸¤¤, ¨Ï¥L¯à°ÊºA§ó·s ³o­Ó½d¨Ò±N²£¥Í¥DÃD¬° username@hostname: directory ¦Óand a prompt of ksh$ . case $TERM in xterm*) HOST=`hostname` PS1='^[]0;${USER}@${HOST}: ${PWD}^Gksh$ ' ;; *) PS1='ksh$ ' ;; esac ¦Ó, $PWD ·|²£¥Í§¹¾ãªº¥Ø¿ý¸ô®|. §Ú­Ì¥i¥H ¥Î ${...##...} ªº¤è¦¡²¾¥h $HOME/ ªº¦r­º. §Ú­Ì¤]¥i¥H¥Î ${...%%...} ªº¤èªk¨ÓºI¥h³¡¥÷ªº hostname: HOST=`hostname` HOST=${HOST%%.*} PS1='^[]0;${USER}@${HOST}: ${PWD##${HOME}/}^Gksh$ ' °O¦í ^[ ¤Î ^G ¦b©R¥O¦C¦r¦ê¬O³æ¤@¦r¤¸ ªº ESC ¤Î BEL (¦b emacs ªºÀô¹Ò¤U¥i ¥H¥Î C-q ESC ¤Î C-q C-g ¿é¤J). 4.5 csh ­n¦b csh §¹¦¨¦P¼Ëªº¨Æ¯uªº¦³ÂI§xÃø, ¦Ó§Ú­Ì¥Î¤U­±ªº¤è¦¡¨Ó¸Ñ¨M°ÝÃD: switch ($TERM) case "xterm*": set host=`hostname` alias cd 'cd \!*; echo -n "^[]0;${user}@${host}: ${cwd}^Gcsh% "' breaksw default: set prompt='csh% ' breaksw endsw ³Â·Ðªº¦a¤è¬O§Ú­Ì­n§â cd ³o­Ó«ü¥O¤Æ¨­¦¨¥i°e¥X·¸¦ì¦r¦êªº¥\¯à. °O¦í ^[ ¤Î ^G ¦b©R¥O¦C¦r¦ê¬O³æ¤@¦r¤¸ªº ESC ¤Î BEL (¦b emacs ªºÀô¹Ò¤U¥i¥H¥Î C-q ESC ¤Î C-q C-g ¿é¤J). °O¦í: ¦b³¡¥÷ªº¨t²Î hostname -s ¥i¯à·|¨ú±o¸ûµuªº hostname ¦Ó¤£¬O§¹¾ãªº¥þ ¦W. ³¡¥÷¨Ï¥ÎªÌ¦b¦³²Å¸¹³sµ²ªº¥Ø¿ýÀ³¸Ó·|µo²{ `pwd` (¬A°_¨Ó¥H½T©w°õ¦æªº¬O pwd «ü¥O) ¥i¥H±o¨ì¤ñ $cwd §óºë½Tªº¸ô®|¦W. 5. Åã¥Ü¥¿¦b°õ¦æªº¤u§@¦WºÙ ³q±`¨Ï¥ÎªÌ·|±Ò°Ê¤@­Ó¤@ª½¦b«e´º°õ¦æªº¤u§@¦p top, ©Î ¤@­Ó½s¿è¾¹, ¤@­Ó email ¥Î¤áºÝ, µ¥µ¥, ¨Ã§Æ±æ³o­Ó¤u§@ªº¦WºÙ³QÅã¥Ü¦b xterm ªº¥DÃD¤W. ³o¬O­Ó «Ü´Æ¤âªº°ÝÃD¥B¥u¯à¦b zsh Àô¹Ò¤U¥i¥H»´ÃP§¹¦¨. 5.1 zsh zsh ¬°³oºØ»Ý¨D´£¨Ñ¤F¤@­Ó«Ü²z·Qªº¤º«Ø¥\¯à: preexec() ¤@­Ó¦b©R¥O°õ¦æ«e¤@©w·|¥s¥Îªº¥\¯à¨ç¦¡¦W $*,$1,... ¶Ç°e¨ì preexec() ªº°Ñ¼Æ ¦]¦¹, §Ú­Ì¥i¥H¥Î¤U­±ªº¤è¦¡§â¤u§@¦WºÙ©ñ¨ì¥DÃD¤W: case $TERM in xterm*) preexec () { print -Pn "\e]0;$*\a" } ;; esac °O¦í: preexec() ¥\¯à¨ç¦¡¦b zsh 3.1.2 ª©¥X²{, ¦pªG§A¥Îªºª©¥»¸û¨º´N»Ý­n §ó·s¤@¤U. 5.2 ¨ä¥L©R¥O¸ÑĶ¾¹s ¹ï¨ä¥¦¯Ê¤Ö preexec() ¨ç¦¡ªº©R¥O¸ÑĶ¾¹, ´N¤£¬O¨º»ò²³æ¤F. ¦pªG¥ô¦ó¤H¦³½d ¨Ò¥i¥H§¹¦¨¦P¼Ëªº¤u§@½Ð§â¥¦ email µ¹§@ªÌ. 6. ªþ¿ý: ¨ä¥¦«¬¦¡²×ºÝ¾÷ªº·¸¦ì§Ç¦C ³\¦h·s¦¡ªº²×ºÝ¾÷³£­l¥Í¦Û xterm ©Î rxvt ¨Ã¥B¤ä´©§Ú­Ì©Ò¨Ï¥Îªº·¸¦ì§Ç¦C. ¬Y ¨Ç±M§Qªº²×ºÝ¾÷ÀHµÛ¦UºØ¤£¦Pªº unix ³c½æ«h·|¨Ï¥Î¥L­Ì¦r­qªº·¸¦ì§Ç¦C. 6.1 IBM aixterm aixterm ¥i¥H¿ëÃÑ¥X xterm ªº·¸¦ì§Ç¦C. 6.2 SGI wsh, xwsh ¤Î winterm ³oÃþ²×ºÝ¾÷·|³]©w $TERM=iris-ansi ¨Ã±Ä¥Î¤U¦Cªº·¸¦ì§Ç¦C: * ESCP1.ystringESC\ ³]©wµøµ¡¥DÃD¬° string * ESCP3.ystringESC\ ³]©w¹Ï¥Ü¥DÃD¬° string ¦Ó xwsh §¹¾ãªº·¸¦ì§Ç¦C¥i¥H°Ñ¦Ò xwsh(1G) ªº¨Ï¥Î»¡©ú. Irix ªº²×ºÝ¾÷¤ä´© xterm ¦U§O³]©wµøµ¡»P¹Ï¥Ü¥DÃDªº¥\¯à, ¦ý¤£¯à¨âªÌ³£³] ©w. 6.3 Sun cmdtool ¤Î shelltool cmdtool ¤Î shelltool ·|³]©w $TERM=sun-cmd ¨Ã±Ä¥Î¤U¦Cªº·¸¦ì§Ç¦C: * ESC]lstringESC\ ³]©wµøµ¡¥DÃD¬° string * ESC]LstringESC\ ³]©w¹Ï¥Ü¥DÃD¬° string ³o¨Ç¯uªº¬O«Ü¥i©Èªºµ{¦¡: ºÉ¶q§O¨Ï¥Î. 6.4 CDE dtterm dtterm ·|³]©w $TERM=dtterm, ¦ü¥G¬O¥i¥HÃѧO¥X¼Ð·Çªº xterm ·¸¦ì§Ç¦C¤Î Sun cmdtool ªº·¸¦ì§Ç¦C (¦b Solaris 2.5.1, Digital Unix 4.0, HP-UX 10.20 ´ú¸Õ¹L). 6.5 HPterm hpterm ·|³]©w $TERM=hpterm ¨Ã±Ä¥Î¤U¦Cªº·¸¦ì§Ç¦C: * ESC&f0klengthDstring ³]©wµøµ¡¥DÃD¬°ªø length ªº string * ESC&f-1klengthDstring ³]©w¹Ï¥Ü¥DÃD¬°ªø length ªº string ¤@­Ó²³æªº C »y¨¥ªºµ{¦¡¥Î¨Ó­pºâªø«×¨Ã¦^À³¦r¦ê, ¦p¤U: #include 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); } §Ú­Ì¤]¥i¥H¼g¤@­Ó¤pªº©R¥O¸}¥»µ{§Ç, ¥Î ${#string} (zsh, bash, ksh) ©Î ${%string} (tcsh) ªº©µ¦ù¥\¯à¨Ó§ä¥X¦r¦êªø«×. ¥H¤U¥i¥Î¦b zsh: 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 7. ªþ¿ý: ¨ä¥¦»y¨¥ªº½d¨Ò ¼g¤@­Ó¤pµ{¦¡§Q¥Î xterm ªº·¸¦ì¥\¯à§â¶Ç»¼ªº°Ñ¼Æ·í¦¨¥DÃD. ¥H¤U¬O¤@¨Ç½d¨Ò. 7.1 C #include int main (int argc, char *argv[]) { printf("%c]0;%s%c", '\033', argv[1], '\007'); return(0); } 7.2 Perl #!/usr/bin/perl print "\033]0;@ARGV\007"; 8. »ÊÁÂCredits ·PÁ¤U¦C½Ñ¦ì´£¨Ñ«Øij, ­×¥¿, ¤Î½d¨Ò¬°¥»¤å¼W¦â¤£¤Ö. Paul D. Smith ¤Î Christophe Martin ¨â¦ì«ü¥X¦b bash $PROMPT_COMMAND ¤¤§Ú¤Þ­zªº¿ù»~ ³¡¥÷. ¥¿½Tªº¤èªkÅÜ¤Æ ¬O °ÊºA®i¶}ªº. Paul D. Smith «Øij¦b bash ¤¤¨Ï¥Î \[...\] ¥H¾ã ¦X¤£¯àÅã¥Üªº¦r¤¸. Christophe Martin ´£¨Ñ ksh ªº¸Ñ¨M¤èªk. Keith Turner ´£¨Ñµ¹ Sun ªº cmdtool ¤Î shelltool ¨Ï ¥Îªº·¸¦ì§Ç¦C. Jean-Albert Ferrez «ü¥X¦b "PWD" ¤Î "$PWD" ¬Û¥Ù¬Þ¤§ ³B, ¤Î "\" »P "\\" ªº¥Îªk. Bob Ellison ¤Î Jim Searle ´ú¸Õ¦b HP-UX ¤Uªº dtterm. Teng-Fong Seak «Øij¥Î -s ¿ï¶µ¥H hostname, ¨Ï¥Î `pwd`, ¥H¤Î ¦b csh ¤U¨Ï¥Î echo . Trilia «Øij¥[¤J¨ä¥L»y¨¥ªº¥Îªk. Brian Miller ¥[¤J hpterm ªº·¸¦ì§Ç¦C»P½d¨Ò. Lenny Mastrototaro ¸ÑÄÀ Irix ²×ºÝ¾÷Àô¹Ò¤U, ¦p¦ó¨Ï¥Î xterm ·¸¦ì§Ç¦C. Paolo Supino «Øij¦b bash ©R¥O¦CÃD¥Ü¤U±Ä¥Î \\$. References 1. mailto:yytseng@ms16.hinet.net 2. http://sunsite.unc.edu/LDP/HOWTO/ 3. http://sunsite.unc.edu/LDP/HOWTO/mini/Xterm-Title.html 4. http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/ 5. http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/ctlseq2.txt 6. http://www.giccs.georgetown.edu/~ric/howto/Xterm-Title/xterm.seq 7. http://www.rxvt.org/ 8. http://language.perl.com/versus/csh.whynot