Linux | 设置select中PS3颜色效果

  • 内容
  • 相关

在select中的PS3设置颜色效果,如图所示

那么是如何实现的呢?

***********************************************************

可行的方法汇总如下

--------------------

1、直接派

PS3="Whats the^[[49;31m book ^[[0mmean?" 

PS3='Whats the^[[49;31m book ^[[0mmean?' 

--------------------

2、$派

PS3=$'Whats the\e[49;31m book \e[0mmean?' 

PS3=$'Whats the\033[49;31m book \033[0mmean?' 

PS3=$'Whats the^[[49;31m book ^[[0mmean?' 

PS3=$"Whats the^[[49;31m book ^[[0mmean?" 

--------------------

3、$(echo -e )派

PS3=$(echo -e 'Whats the\033[49;31m book \033[0mmean?') 

PS3=$(echo -e 'Whats the\e[49;31m book \e[0mmean?') 

PS3=$(echo -e 'Whats the^[[49;31m book ^[[0mmean?') 

PS3=$(echo -e "Whats the\033[49;31m book \033[0mmean?") 

PS3=$(echo -e "Whats the\e[49;31m book \e[0mmean?") 

PS3=$(echo -e "Whats the^[[49;31m book ^[[0mmean?") 

--------------------

\033、\e和^[ 比较

^[通用性最强,\033与\e相同;

“”(双引号)和‘’(单引号)比较

‘’通用性比“”强

方法1:标准的正则表达;

方法2:很酷

方法3:通过$()进行echo操作,将带颜色的信息赋予PS3。

 您阅读这篇文章共花了:

上一篇:Docker | Dockerfile 编写:ssh服务

下一篇:Linux | shell中的wanted 'EOF'错误解决

本文标签:    

版权声明:本文依据CC-BY-NC-SA 3.0协议发布,若无特殊注明,本文皆为《fishyoung》原创,转载请保留文章出处。

本文链接:Linux | 设置select中PS3颜色效果 - http://www.fishyoung.com/post-249.html