Bash添加多行到文件的方法

cat <<EOT >> greetings.txt
line 1
line 2
EOT

方法二:

echo "line 1
line 2" >> greetings.txt

参考:

shell – How to append multiple lines to a file – Unix & Linux Stack Exchange