【发布时间】:2018-01-12 21:22:32
【问题描述】:
我正在尝试从我的脚本中随机选择并将其放入 /tmp/test.php 文件中的一个新文件中,例如。但它不会创建文件。我认为使用 EOF 会选择我需要的内容并对其进行处理,但它似乎不起作用。
#!/bin/bash
cat /tmp/test.php << \EOF
<?php
test, you are awesome, haha.
test 2, this is some php, not finished,.
?>
EOF
echo script continues
....
....
Continues
etc
现在我应该可以进入 tmp 并查看我的 test.php 我做错了什么
【问题讨论】:
-
将
cat /tmp/test.php替换为cat >/tmp/test.php。