Subject: sed-bug

From: wu <[email-masked]>
Date: Thu, 28 Nov 2024 15:18:08 +0800 (CST)

[root@localhost ~]# cat demo.txt 

[root@localhost ~]# sed -i '$a \test_fields\ntest_fields1' demo.txt

[root@localhost ~]# cat demo.txt 

[root@localhost ~]# echo "" >> demo.txt 

[root@localhost ~]# sed -i '$a \test_fields\ntest_fields1' demo.txt

[root@localhost ~]# cat demo.txt 

est_fields

test_fields1

[root@localhost ~]# 

There must be one line of content in the file, even if it is an empty line, content can be added
Cannot add content to an empty file using the sed command