Subject: Files-that-are-commands.
To: None <netbsd-help@netbsd.org>
From: Richard Rauch <rkr@rkr.kcnet.com>
List: netbsd-help
Date: 01/12/2000 01:48:09
A passing thought just hit me, something that I don't know how to do under
UNIX-like systems.  (Surely, it _is_ possible?)

I'd like to have a file (say, my .signature) run a shell command everytime
it is read.  On the dear old Amiga, one could do this by using a filename
under a kind of pipe-device (I believe the one that worked this way was a
part of the AmiTCP/IP distribution, but that's neither here nor there).

Effectively, this is like telling the program to popen() the command, save
that the program doesn't have to know to use popen()---it just uses
open() or fopen() or whatever.

(As I write this, it occurs to me that there are potential security
problems---you don't want to run this in the reader's aegis, and running
it as the file-owner makes it effectively a setuid program.  An important
point, however, is that the program, while running, isn't available to the
user, save via stdout (and stderr?) coming out of read() calls...if the
executing command tries to read stdin, it should obviously get EOF.)


Anyway, can it be done with commands that ship with NetBSD?


  "I probably don't know what I'm talking about."  --rkr@rkr.kcnet.com