I guess I know when there is a pipe (|) the left-side command is executed first and the result is passed to the right-side command of pipe but...
apt update | sudo tee
... how can work that way? there is any "syntactic sugar" involved?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
when there is a pipe (|) the left-side command is executed first and the result is passed to the right-side command of pipe
Both processes start off at the same time. So, in your example
apt update and
sudo tee starts at the same time, and the STDOUT of
apt update is passed on the STDIN of
There is no syntactic sugar involved, anonymous pipe (
|) is a common (and old) form of IPC in *nix.
FWIW, there's also another form of pipe IPC -- named pipe.