请教:如何修改select菜单提示信息(PS3)颜色(已解决)
发表于 : 2012-01-31 21:10
脚本如下:
cat test.sh
----------------------------------
#!/bin/bash
PS3="What does the book mean?"
select mean in 书 花 美女 帅哥
do
if [ $mean == "书" ]
then
echo "you are genius!"
exit
else
echo "How foolish you are!"
fi
done
运行结果
----------------------------------
1) 书
2) 花
3) 美女
4) 帅哥
What does the book mean?1
you are genius!
而我期望的提示信息为
----------------------------------
What does the book mean?
即用红色字体强调book一词,与下述echo效果相同
echo -e "Whats the\033[49;31m book \033[0mmean?"
echo尚好,select就不知道该怎么办了,望大牛指导,谢谢!

cat test.sh
----------------------------------
#!/bin/bash
PS3="What does the book mean?"
select mean in 书 花 美女 帅哥
do
if [ $mean == "书" ]
then
echo "you are genius!"
exit
else
echo "How foolish you are!"
fi
done
运行结果
----------------------------------
1) 书
2) 花
3) 美女
4) 帅哥
What does the book mean?1
you are genius!
而我期望的提示信息为
----------------------------------
What does the book mean?
即用红色字体强调book一词,与下述echo效果相同
echo -e "Whats the\033[49;31m book \033[0mmean?"
echo尚好,select就不知道该怎么办了,望大牛指导,谢谢!
