我有例如下面的代碼:殼牌 - 創建追加內容的文本文件 - 使用貓
rm /etc/rc.local
cat <<EOF >/etc/rc.local
#!/bin/sh -e
apt-get update && apt-get -y install git-core
EOF
有沒有一種方法而不是它的,所以我不需要刪除原來的rc.local中和做一個新的,但我可以使用幾乎相同的代碼,但追加這個內容到rc.local文件的底部,而不是重新創建它?
我有例如下面的代碼:殼牌 - 創建追加內容的文本文件 - 使用貓
rm /etc/rc.local
cat <<EOF >/etc/rc.local
#!/bin/sh -e
apt-get update && apt-get -y install git-core
EOF
有沒有一種方法而不是它的,所以我不需要刪除原來的rc.local中和做一個新的,但我可以使用幾乎相同的代碼,但追加這個內容到rc.local文件的底部,而不是重新創建它?
試試這個:
cat <<EOF >>/etc/rc.local
apt-get update && apt-get -y install git-core
EOF
或者乾脆:
echo 'apt-get update && apt-get -y install git-core' >> /etc/rc.local
使用>>而不是> – 2013-02-19 13:15:18