这在Linux sed'$ a \'a.txt中意味着什么

Piy*_*ume 5 linux shell sed

我的Linux shell脚本中有这一行

sed '$a\' < file_a.txt
Run Code Online (Sandbox Code Playgroud)

害怕从代码中删除它,无法找到它的用途.

Tho*_*hel 5

它确保输出以换行结束; 看到:

echo -ne test | sed '$a\'
# same output as:
echo test | sed '$a\'
Run Code Online (Sandbox Code Playgroud)

正如您在前面的代码中看到的那样,第二个示例中未添加回车符,但在第一个示例中添加了回车符.当然,如果删除sed部件,输出将不同,因为第一个echo语句没有回车符.