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. //第三行默認換行,而且第四行前制定換行,因此中間空了一行