Why sudo cat gives a Permission denied but sudo vim works fine?

前端 未结 6 2054
生来不讨喜
生来不讨喜 2021-01-29 22:41

I am trying to automate the addition of a repository source in my arch\'s pacman.conf file but using the echo command in my shell script. However, it fails like th

6条回答
  •  情书的邮戳
    2021-01-29 22:44

    append files (sudo cat):

    cat  | sudo tee -a 
    

    append echo to file (sudo echo):

    echo  | sudo tee -a 
    

    (EXTRA) disregard the ouput:

    echo >origin> | sudo tee -a  >/dev/null
    

提交回复
热议问题