Ubuntu shell脚本无法正常工作

时间:2012-05-17 20:30:23

标签: shell ubuntu cat

使用此脚本,我想在/ etc / hosts文件中附加一行文本。该脚本似乎不起作用。有什么问题?

su 
cd /etc
cat /home/rugile/file >> hosts

/ home / rugile / file看起来像这样:

127.0.0.1 domain.com

1 个答案:

答案 0 :(得分:1)

su打开一个新shell。你需要提供命令。

su << EOF
 ...
EOF