Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cos!hadron!jsdy From: jsdy@hadron.COM (Joseph S. D. Yao) Newsgroups: comp.unix.shell Subject: Re: Yet Another bourne shell query Message-ID: <915@hadron.COM> Date: 12 Oct 90 15:37:29 GMT References: <437@minya.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 35 In article <437@minya.UUCP> jc@minya.UUCP (John Chambers) writes: >Recently, I've had the fun of modifying programs so they can be started >by init and/or inetd, and still work. ... >environ[0] == (char *)0), and with NO open files. ... >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 /dev/null 2>&1 or even HOME=/ /bin/ksh /etc/my_shell_prog < /dev/null > /dev/null 2>&1 Note that it is nowhere promised that there would be anything IN environ, or even in argv, merely that they would be there. Program so as to take into account the worst possibility, and things will usually work out much better. Joe Yao jsdy@hadron.COM ( jsdy%hadron.COM@{uunet.UU.NET,decuac.DEC.COM} ) arc,arinc,att,avatar,blkcat,cos,decuac,\ dtix,ecogong,grebyn,inco,insight,kcwc, \ lepton,lsw,netex,netxcom,phw5,research, >!hadron!jsdy rlgvax,seismo,sms,smsdpg,sundc,telenet, / uunet / (Last I counted ...)