Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有以下代码:
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