Next Previous Contents

4. ¦³¨º¨ÇÃC¦â¥i¥H¿ï¾Ü©O?

¤U­±ªº shell ©R¥O½Z(·PÁ³\¦h§â bash ªºª©¥»±Hµ¹§Úªº¤H)Åã¥Ü¥X²{¦b¨Ï¥Îªº¥D±±¥x¯à°÷¤ä´©ªº¦UºØÃC¦â²Õ¦X¡C¦pªG¨S¦³ÃC¦â¥X²{¡A¨º»ò§Aªº¥D±±¥x´N¤£¤ä´© ANSI ªºÃC¦â¿ï¾Ü¡C

#!/bin/bash
# Åã¥Ü ANSI ªº±m¦â
#
esc="\033["
echo -n " _ _ _ _ _40 _ _ _ 41_ _ _ _42 _ _ _ 43" 
echo "_ _ _ 44_ _ _ _45 _ _ _ 46_ _ _ _47 _"
for fore in 30 31 32 33 34 35 36 37; do
  line1="$fore  " 
  line2="    "
  for back in 40 41 42 43 44 45 46 47; do
    line1="${line1}${esc}${back};${fore}m Normal  ${esc}0m"
    line2="${line2}${esc}${back};${fore};1m Bold    ${esc}0m"
  done
  echo -e "$line1\n$line2"
done

«e´ºªºÃC¦â¸¹½X¬O¦b¥ªÃ䨺¤@±Æ¡A­I´ºªº«h¬O¦b¤W¤è¡C¦pªG§A­n²ÊÅ骺¦r¤¸©M°ª«G«×´N¦b°Ñ¼ÆùØ¥[¤@­Ó "1"¡A©Ò¥H«e´º¬O¥Õ¦â¦Ó­I´º¬OÂŦâ´N¦¨¤F "37;44;1"¡C¾ã­Óªº ANSI ÃC¦â¿ï¾Ü§Ç¦C´N¬O

ESC [ 3 7 ; 4 4 ; 1 m
¡C

µù: ­I´º¤£¥i¥H¬O°ª«G«×¡A©Ò¥H¶À¦â(°ª«G«×ªº´Ä¦â)¥u¯à¥Î¨Ó§@«e´º¡C³o¬OµwÅé¤Wªº­­¨î¡C

ÃC¦â¥N½X:
        0 - ¶Â¦â     4 - ÂÅ¦â           3# ¬O­I´ºÃC¦â
        1 - ¬õ¦â     5 - ¯»¬õ¦â         4# ¬O«e´ºÃC¦â
        2 - ºñ¦â     6 - «C¦â
        3 - ¶À¦â     7 - ¥Õ¦â           ;1 ¬O²ÊÅé©M°ª«G«×


Next Previous Contents