Next Previous Contents

6. ¦p¦ó§ïÅܨt²Îªº¹w³]­È: «e´º¥Õ¦â¦Ó­I´º¬O¶Â¦â

§A»Ý­n§i¶D§Aªº²×ºÝ¾÷ÅX°Êµ{¦¡§A·Q­nªº¥t¤@­Ó¹w³]­È¡C­n¦p¦ó§@¨Ã¨S¦³¤@­Ó¼Ð·Çªº¤èªk¡A¤£¹L¦pªG§A¬O¥Î Linux ªº¸Ü¡A§A¦³ setterm ³o­Óµ{¦¡¥i¥H¥Î¡C

"setterm" ¨Ï¥Î²×ºÝ¾÷¸ê®Æ®wùتº¸ê®Æ¨Ó³]©wÄÝ©Ê¡C­n¿ï¾ÜÄݩʪº¸Ü­n³o¼Ë§@

setterm -foreground black -background white -store

"-store" °Ñ¼Æ§â²{¦b©Ò§@ªº§ïÅܳ]©w¦¨¹w³]­È¡C³o»Ý­n§A²{¦b¨Ï¥Îªºªº²×ºÝ¾÷ºØÃþ(¦b TERM Àô¹ÒÅܼÆùØ)¦b termcap ¸ê®Æ®wùئ³¨¬°÷¸Ô²Óªº¬ö¿ý¡C¦pªG setterm ¦]¬°¬YºØ¦]¯À¤£¯à¥¿±`ªº¤u§@¡A§AÁÙ¦³¨ä¥¦ªº¿ï¾Ü¡C

6.1 Xterm

§A­n¦³¦Ü¤Ö¤@ºØ¤U¦Cªº xterm¡A¦Ó¥B­n¤ä´©±m¦â¡C

xterm -fg white -bg blue4
color_xterm -fg white -bg blue4
color-xterm -fg white -bg blue4
nxterm -fg white -bg blue4

³oùتº 'color_xterm' ¤ä´©±m¦âª©ªº 'ls'¡C³oùتºÃC¦â¿ï¾Ü¬O¼Ò§Ï SGI ¤W­±¨Ï¥ÎªºÃC¦â¡C

6.2 µêÀÀ¥D±±¥x

§A¤]¥i¥H­×§ï®Ö¤ß¡A³o¼Ë´N¥i¥H¤@³Ò¥Ã¶hªº¥Î±±¨î½X¨Ó§ïÅܵêÀÀ¥D±±¥xªº¹w³]­È¡C¦pªG§A¦Û¤v½sĶ®Ö¤ßªº¸Ü¡A§Ú«Øij§Q¥Î kernel ªººó¸ÉÀÉ¡C

®Ö¤ßªº­ì©l½X¬O¦b /usr/src/linux/drivers/char/console.c ¡A¤j·§¦b 1940 ¦æ¡A³o¬O§AÀ³¸Ó­×§ïªº¦a¤è

        def_color       = 0x07;   /* white */
        ulcolor         = 0x0f;   /* bold white */
        halfcolor       = 0x08;   /* grey */
        def_color       = 0x17;   /* white */
        ulcolor         = 0x1f;   /* bold white */
        halfcolor       = 0x18;   /* grey */

³oÃ䪺¤Q¤»¶i¦ì¼Æ¦r¬Oµ¹Åã¥Ü¥d¥Îªº: ³Ì¥ªÃ䪺¦ì¤¸(¤W­±½d¨Òªº "1")¬O­I´º ; ³Ì¥kÃ䪺¦ì¤¸¬O«e´º¡C0 = ¶Â¦â¡A1 = ÂŦâ¡A2 = ºñ¦â¡A3 = «C¦â, 4 = ¬õ¦â, 5 = µµ¦â¡A6 = ´Ä¦â/¶À¦â¡A7 = ¥Õ¦â¡C§â¼Æ¦r¥[ 8 ¥i¥H±o¨ì°ª«G«×ªºÃC¦â¡C¦b¤j³¡¥÷ªº±¡ªp¤U¡A°ª«G«×ªº­I´º¦â == °{Ã{ªº¦r¥[¤W´¶³qªº­I´º¡C ¥Ñ sjlam1@mda023.cc.monash.edu.au ©Ò´£¨Ñ

§A¤]¥i¥H¨Ï¥Î¤U­±ªº ANSI ±±¨î½X´£¨Ñ¤@­Ó°õ¦æ®É´Áªº¥D±±¥x¹w³]­È¡C(¦b®Ö¤ß­ì©l½Xùاä¨ìªº)

        ESC [ 8 ]

³o­Ó±±¨î½X§â¹w³]­È³]¦¨¥Ø«eªº«e´º¤Î­I´ºÃC¦â¡CµM«á­«³]Äݩʪº±±¨î½X(ESC [ m)Åý³o¹w³]­È°¨¤W´N¨ú¥N¶Â¥Õ¦â¦¨¬°¨Ï¥Î¤¤ªºÃC¦â¡C

¨C¦¸§A­«¶}¾÷ªº®É«J§A³£»Ý­n¦A§â³o¨Ç¦r¦ê°eµ¹¥D±±¥x¡C¨Ì·Ó§Aªº Linux ¥D¾÷¥Î³~¤£¦P¡A¦³¦n´X­ÓÀÉ®×¥i¥H¹F¦¨³o­Ó¥Øªº¡C

/etc/issue

¦b Slackware ùسo´N¬O "Welcome to Linux xx.yy" °T®§©Ò¦bªºÀɮסA¦pªG§Aªº¥D¾÷¬O­Ó¤H¨Ï¥Îªº¸Ü¡A±q³o­ÓÀɮפU¤â¬O¤£¿ùªº¿ï¾Ü(¦ý¹ï©ó¥Î telnet »·ºÝµn¤J¨Ï¥Î¨t²Îªº¤H´N¥i¯à¦³ÂI°Q¹½)¡C ³o­ÓÀɮצb¨C¦¸¶}¾÷ªº®É«J³£·|³Q»s³y¥X¨Ó¡A­ì¨Óªº¤º®e«h³QÂл\¡A©Ò¥H§A¥²»Ý­n­×§ï¶}¾÷ÀÉ®×(¦b Slackware ùجO /etc/rc.d/rc.S¡ARedhatùجO /etc/rc.d/rc.local)ùØ­±ªº¤U¦C´X¦æ:

  echo ""> /etc/issue
  echo Welcome to Linux `/bin/uname -a | /bin/cut -d\  -f3`. >> /etc/issue
§ï¦¨
  ESCAPE="¦b³oùØ©ñ¤J ESC ½X"
  echo "${ESCAPE}[H${ESCAPE}[37;44m${ESCAPE}[8]${ESCAPE}[2J"> /etc/issue
  echo Welcome to Linux `/bin/uname -a | /bin/cut -d\  -f3`. >> /etc/issue

³oùتº±±¨î½X·|§â¹C¼ÐÂk¦ì¡B³]©wÃC¦â(¦b³oùتº«e´º¬O¥Õ¦â¦Ó­I´º¬OÂŦâ)¡B§â³o­Ó³]©w¦s°_¨Ó¨Ã¥B§â¿Ã¹õ¤W¨ä¥¦³¡¥÷²M°£±¼¡C ³oùتº§ïÅÜ·|¦b¤U¦¸­«¶}¾÷®É¥Í®Ä¡C§O§Ñ¤F¦b emacs ­n¥´¤J ESC ¦r¤¸­n«ö C-q Áä¦Ó¦b vi ùØ­n«ö control-v¡A¦]¬°«ÜÅãµMªº°õ¦æ¥H¤Wµ{¦¡ªº sh ¨Ã¤£¤F¸Ñ /033 ³oºØ¥Îªk¡C

/etc/profile ©Î .profile

  if [ "$TERM" = "console" ]; then
      echo "\033[37;44m\033[8]" #
# ©Î¨Ï¥Î setterm¡C
      setterm -foreground white -background blue -store
  fi

/etc/login ©Î .login

  if ( "$TERM" == "console" ) then
    echo "\033[37;44m\033[8]"  
# ©Î¨Ï¥Î setterm¡C
      setterm -foreground white -background blue -store
  endif

[ ĶªÌª`: Linux ªº¥D±±¥x¤Uªº $TERM Àô¹ÒÅܼƤw¸g¬O "linux" ¦Ó¤£¬O "console" ¤F ]

6.3 »·ºÝµn¤J

§AÀ³¸Ó¥i¥H¥Î¤W­±¥Ü½d¹Lªº setterm µ{¦¡¡C·íµM¡A»·ºÝªº¾÷¾¹¥²»Ý­n¯à°÷±o¨ì¨¬°÷ªº¸ê°T¨Ó¾Þ§@§Aªº²×ºÝ¾÷¡A¦Ó¥B§Aªº²×ºÝ¾÷¼ÒÀÀµ{¦¡­n¯à°÷¤ä´©±m¦â¡C ¦b§Úªº¸gÅçùب䥦¥­¥x¤W³Ì¦nªº vt100 ²×ºÝ¾÷¼ÒÀÀµ{¦¡¦³¤U¦C´XºØ:

Ãö©ó kermit ªº²Ó¸`½Ð¬Ý http://www.columbia.edu/kermit/


Next Previous Contents