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



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.

"executable" and "program" mean roughly the same thing, if you don't
get into too many arguments over shared libraries and unlinked
object code. Executables are files. Files are not necessarily
executable.

A file with no execute permission cannot be executed as though
it were a program. That's what:
party | /dev/null
is attempting to do. A file that is not a valid executable file
(e.g. because it doesn't contain any code but contains only porn,
last week's grocery list, or pirated music, or contains code for
the wrong CPU type, or something the OS doesn't support) also cannot
be run as a program. If it has execute permission the shell may
attempt to run it as a shell script, which is usually something
between hilarious and a disaster.

You also can't do:
m-net% /dev/null
OR
m-net% party ; /dev/null
for the same reasons, although the second one will appear to work
until you exit party.

You can, as root, cd to the directory containing party, then:
m-net# cat /dev/null > party
but it's not recommended since you'll replace "party" with an empty
file, and it will quit working.

.



Relevant Pages

  • Re: Whats the difference pipe vs redirection is the following case case.
    ... Welcome to PARTY! ... m-net% party | /dev/null ... because it instructs the shell to start the program /dev/null ... The execute permission bit tells the OS ...
    (comp.unix.programmer)
  • Re: sp_setapprole with third party program using ODBC
    ... As I understand there is no place to add such a command to MS ODBC settings ... "execute sp_setapprole". ... party supplies such an option also. ...
    (microsoft.public.sqlserver.security)
  • Re: triggers opening an Access Form
    ... In the Access database, which I am assuming you (not the 3rd party you ... in your code is where you would execute the ... JOE wrote: ...
    (microsoft.public.sqlserver.programming)
  • Re: Copywrong?
    ... > how can myself 'using images without the permission of the owner' ... A similiar assumption could be made on my part that if they don't care ... I believe plagarism is against eBay rules. ... > Whether the creator of the website or some other party or no- ...
    (uk.people.consumers.ebay)
  • Re: Missing from the FAA database now
    ... If you want to hire me as a limo driver, I have to request a copy of my ... You also need my permission to do a criminal ... Someone seeking employment has the right to have any party ... disclose any records they may have about that person. ...
    (rec.aviation.piloting)