LoginSignup
0

More than 3 years have passed since last update.

posted at

bashで文字にに色がつかない

何も考えない場合 $'' 使え

zshだと何もしなくても色がついてたのでbashで実行した時に焦った
変数使う時にめちゃくちゃめんどくさいんだけど

bash-3.2$ echo -e "\e[32;1m[MESSAGE]\e[m"
\e[32;1m[MESSAGE]\e[m

bash-3.2$ echo -e '\e[32;1m[MESSAGE]\e[m'
\e[32;1m[MESSAGE]\e[m

bash-3.2$ echo $'\e[32;1m[MESSAGE]\e[m'
[MESSAGE]

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0