须藤回声"东西" >>在/ etc / privilegedFile不工作...是否有别的选择吗? [英] sudo echo "something" >> /etc/privilegedFile doesn't work... is there an alternative?
本文介绍了须藤回声"东西" >>在/ etc / privilegedFile不工作...是否有别的选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个pretty简单的问题,至少现在看来似乎应该是,大约在Linux中sudo的权限。
This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux.
有很多时候,我只是想将一些东西附加到 / etc / hosts中
或类似的文件,但最终没有能够因为两个>
和>方式>
是不允许的,即使有根
There are a lot of times when I just want to append something to /etc/hosts
or a similar file but end up not being able to because both >
and >>
are not allowed, even with root.
有什么方法来完成这项工作,而无需苏
或须藤苏
成根?
Is there someway to make this work without having to su
or sudo su
into root?
推荐答案
使用三通:
echo 'deb blah # blah' | sudo tee --append /etc/apt/sources.list
请一定要避免引号内的报价。
Make sure to avoid quotes inside quotes.
要避免打印数据传回控制台:
To avoid printing data back to the console:
echo 'deb blah # blah' | sudo tee --append /etc/apt/sources.list > /dev/null
这篇关于须藤回声"东西" >>在/ etc / privilegedFile不工作...是否有别的选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文