Piping and Redirection

前端 未结 5 2104
挽巷
挽巷 2020-12-01 03:15

What is exact difference between piping and redirection?

Where should we use piping and where should we use redirection?

How they internall

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 03:38

    I have noticed that pipelining applies to the output of process substitution, but not redirection:

    bash-3.2$ echo $'one\ntwo\nthree' | tee >(grep o) | cat > pipe
    bash-3.2$ echo $'one\ntwo\nthree' | tee >(grep o) > redirect
    bash-3.2$ one
    two
    
    bash-3.2$ cat pipe
    one
    two
    three
    one
    two
    bash-3.2$ cat redirect
    one
    two
    three
    

提交回复
热议问题