Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!mit-eddie!minya!jc From: jc@minya.UUCP (John Chambers) Newsgroups: comp.unix.shell Subject: Yet Another bourne shell query Message-ID: <437@minya.UUCP> Date: 31 Aug 90 02:06:01 GMT Lines: 27 Hey, wow!, a special group for all my dumb shell questions! And I just happen to have one to ask... Recently, I've had the fun of modifying programs so they can be started by init and/or inetd, and still work. These daemons, unlike shells, have a way of starting programs with very little initialization. On some of my recent portability tests, I have even come across one Unix system whose init starts things with an empty environ vector (i.e., environ[0] == (char *)0), and with NO open files. Yes, you read that right; files 0, 1 and 2 are not open. It does at least make argv[0] contain a pointer to the program's name, and argc is correct, so I guess I really shouldn't complain. But this causes interesting problems when the "program" is a shell script. In C, I know how to call fstat() and test the result for zero. In Bourne Shell, I don't know how to do the equivalent. I basically want to write something like: if [ ];then exec