Re: What's the difference pipe vs redirection is the following case case.



On Jun 21, 6:33 pm, j...@xxxxxxxxxxx (Jens Thoms Toerring) wrote:
K-mart Cashier <cdal...@xxxxxxxxx> wrote:
When I execute party, it brings up a chat line. Ie
m-net% party
Welcome to PARTY!  Type '?' for help:
triluda:  my hero
mickeyd:  are we cheech'n'chongish enough?
When I do the following
m-net% party | /dev/null
zsh: permission denied: /dev/null
I get permission denied.
But when I do something like the following
m-net% party > /dev/null
Welcome to PARTY!  Type '?' for help:
e
The output from party gets redirected to /dev/null
What's the difference between the two? Ie, why do I get permission
denied when I try to pipe party to /dev/null?

Because you can pipe to another process but not a file. '|' is
for connecting the stdout of the process on the left hand side
to the stdin of the process of the right hand side. '>' is for
redirecting the stdout of the left hand side process to a file
on the right hand side. You get permission denied for

m-net% party | /dev/null

because it instructs the shell to start the program /dev/null
but, when the shell tries to do so, it finds that /dev/null
hasn't the executable bit set (which makes sense since /dev/null
isn't an executable but just a "file", not a program).


Maybe I'm overcomplicated this a bit, but what's the difference
between an executable, a "file", and a program? I thought an
executable was a program.



.



Relevant Pages