2017年5月29日 星期一

[Linux 常見問題] How does one output bold text in Bash?

Source From Here
Question
I'm writing a Bash script that prints some text to the screen:
  1. echo "Some Text"  
Can I format the text? I would like to make it bold.

How-To
The most compatible way of doing this is using tput to discover the right sequences to send to the terminal:
  1. bold=$(tput bold)  
  2. normal=$(tput sgr0)  
then you can use the variables $bold and $normal to format things:
  1. echo "this is ${bold}bold${normal} but this isn't"  
gives
this is bold but this isn't


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...