$ my-program < a-file
# or
$ some-program | some-other-program
etc.
In general when you open a socket you get/use a new filehandle especially for that socket, since even though it's possible to re-open STDIN in some other way later (through a socket or file or whatever) that would IMO just be confusing.
Though most unix systems have a fairly similar ways to deal with startup/shutdown scripts through various runlevel files etc, the differences in how to administrate those files easily are different enough that you should probably just look up your system's documentation.
If you want to become better informed about all these issues, I recommend Advanced Programming in the UNIX Environment (2nd edition).
|