如何一个输出大胆的文字在bash? [英] How does one output bold text in BASH?
本文介绍了如何一个输出大胆的文字在bash?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在写打印一些文字到屏幕上一个bash脚本:
I'm writing a bash script that prints some text to the screen:
echo "Some Text"
我可以格式的文本?我想使它大胆。
Can I format the text? I would like to make it bold.
推荐答案
这样做是使用的最兼容的方式 tput的
来发现正确的顺序发送到终端
The most compatible way of doing this is using tput
to discover the right sequences to send to the terminal:
bold=$(tput bold)
normal=$(tput sgr0)
那么你可以使用变量 $粗体
和 $正常值
来的东西格式:
echo "this is ${bold}bold${normal} but this isn't"
给
这是粗体但这不是
这篇关于如何一个输出大胆的文字在bash?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文