使用单引号即可成功写入
[root@localhost aimerTest]# echo "guess whaaaaat!!!" >> file1
bash: !": event not found
[root@localhost aimerTest]# echo "guess whaaaaat" >> file1
[root@localhost aimerTest]# cat file1
guess whaaaaat
[root@localhost aimerTest]# echo 'guess whaaaaat!!!' >> file1
[root@localhost aimerTest]# cat file1
guess whaaaaat
guess whaaaaat!!!
[root@localhost aimerTest]# >file1
[root@localhost aimerTest]# cat file1
命令解释
echo
:写入文件/输出内容cat
:正序输出文件内容,tac
:逆序输出文件内容>[fileName]
:清空fileName中的内容