Xref: utzoo comp.sys.att:2298 comp.unix.questions:5333 Path: utzoo!utgpu!water!watmath!clyde!burl!codas!mtune!bakerst!kathy From: kathy@bakerst.UUCP (Kathy Vincent) Newsgroups: comp.sys.att,comp.unix.questions Subject: Re: Using 'exit' in a Bourne shell script Message-ID: <1062@bakerst.UUCP> Date: 31 Jan 88 08:04:54 GMT References: <169@mccc.UUCP> Reply-To: kathy@bakerst.UUCP (Kathy Vincent) Organization: AT&T, Winston-Salem, NC Lines: 29 In article <169@mccc.UUCP> pjh@mccc.UUCP (Peter J. Holsberg) writes: >I would like to have my users logout via a shell script "off" rather >than with ^d. The script I wrote is very simple, but 'exit' has no >effect. ... > >The correct entries appear in /usr/.logins, but 'exit' seems to be >ignored. The exit in your shell script is only going to get you out of that script. In fact, sending exit codes is one way of communicating between scripts ( if [ script exits with a number "n" ] then ...). A friend of mine solved that problem thusly. He was only interested in his own .profile, but trap '$HOME/.logout' 0 Which is to say, "when you receive the logoff signal, execute $HOME/.logout first and THEN log off." I believe there's probably a problem with this, though: Traps can be reset, so a user could, as I understand it, ask to have something else happen at signal 0 , thereby negating what you're trying to do. Someone correct me if I'm wrong about this (I'm sure someone will) 'cuz I'd like to know. Kathy Vincent ------> {ihnp4|mtune|codas|ptsfa}!bakerst!kathy ------> {ihnp4|mtune|burl}!wrcola!kathy ------> { favourite AT&T gateway }!wruxe!unix