linux输入多行内容至文件
1. 单行写入
[root@cn01 test]# echo "192.168.1.1" >test.txt
[root@cn01 test]# cat test.txt
192.168.1.1
2. 单行追加
[root@cn01 test]# echo "192.168.1.1" >>test.txt
[root@cn01 test]# cat test.txt
192.168.1.1
192.168.1.1
3. 多行写入
[root@cn01 test]# cat>test.txt <<-EOF
> 123
> 345
> EOF
[root@cn01 test]# cat test.txt
123
345
4. 多行追加
[root@cn01 test]# cat>>test.txt <<-EOF
123
345
EOF
[root@cn01 test]# cat test.txt
123
345
123
345
123
345