LoginSignup
1
0

More than 5 years have passed since last update.

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

Posted at

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

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]
1
0
0

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
  3. You can use dark theme
What you can do with signing up
1
0