011#ANSI顏色系列

#!/bin/bash # ANSI color --- initializeANSI() { esc="\e" # 同'\033' # 前景色: blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m"; yellowf="${esc}[33m"; bluef="${esc}[34m"; purplef="${esc}[35m"; cyanf="${esc}[36m"; whitef="${esc}[37m"; # 背景色: blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m"; yellowb="${esc}[43m"; blueb="${esc}[44m"; purpleb="${esc}[45m"; cyanb="${esc}[46m"; whiteb="${esc}[47m"; # 粗體、斜體、下劃線以及樣式切換: boldon="${esc}[1m"; boldoff="${esc}[22m"; italicson="${esc}[3m"; italicsoff="${esc}[23m"; ulon="${esc}[4m"; uloff="${esc}[24m"; invon="${esc}[7m"; # 反色,前景色與背景色互換 invoff="${esc}[27m"; reset="${esc}[0m" } initializeANSI echo -e " ${yellowf}This is a phrase in yellow${redb} and red background.${reset} ${boldon}This is bold ${ulon}this is underline${reset} ${italicson}This is italics${italicsoff} and ${reset}reset to nornal ${yellowf}${redb}Warning 1${yellowb}${redf}Warning 2${reset} ${invon}${yellowf}${redb}Warning 1${invoff}${yellowb}${redf}Warning 2${reset} "
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章