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。
您阅读这篇文章共花了: