echo换行输出需要转义符 -e

看以下例子:

1 echo -e "It is the first line." >> a; echo -e "It is the second line.\c" >> a; echo -e "It is the third line." >> a; echo -e "\nIt is the forth line." >> a

输出:

It is the first line.                                   //默认换行
It is the second line.It is the third line.             //第二行指定不换行,因此第三行紧跟第二行
                                    
It is the forth line.                                  //第三行默认换行,而且第四行前制定换行,因此中间空了一行

 

相关文章:

  • 2022-01-15
  • 2022-01-20
  • 2021-12-07
  • 2022-12-23
  • 2021-07-23
  • 2021-11-17
  • 2021-08-19
  • 2021-11-20
猜你喜欢
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-10-20
  • 2022-12-23
相关资源
相似解决方案