我有一个看起来像这样的文件:
> cat my.txt
This is sentence 1.
This is sentence 2.
<empty line>
This is sentence 3.
在我的 bash 脚本中,当我添加尝试通过电子邮件发送文件时,会出现额外的一行。
#!/bin/bash
outf="/tmp/my.txt"
action=`cat $outf`
echo $action | mail -s "my test" emailid@mail.com
这是电子邮件的样子:
This is sentence 1.
<empty line>
This is sentence 2.
<empty line>
<empty line>
This is sentence 3.
<empty line>
如何删除多余的空行?