Unix: confusing use of the Tee -command

前端 未结 8 1838
野趣味
野趣味 2021-02-07 14:31

Manual states that the tee is a \"pipe fitting\"-tool. The cases [1] confuse me:

1. case

echo \"foo bar\" | sudo tee -a /path/to/some/fi         


        
8条回答
  •  生来不讨喜
    2021-02-07 14:37

    tee simply mirrors the output into a file that can be specified as the argument to tee.

    In the case you show tee is called as the super user (via sudo) and it's sole purpose is to write a file as the super user instead if the user that does the echo.

提交回复
热议问题