Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site redwood.UUCP Path: utzoo!utcs!lsuc!pesnta!hplabs!hpda!fortune!redwood!rpw3 From: rpw3@redwood.UUCP (Rob Warnock) Newsgroups: net.unix Subject: Re: getting the pid from the csh Message-ID: <159@redwood.UUCP> Date: Thu, 14-Feb-85 05:53:40 EST Article-I.D.: redwood.159 Posted: Thu Feb 14 05:53:40 1985 Date-Received: Fri, 15-Feb-85 02:13:21 EST References: <240@wanginst.UUCP> <402@lsuc.UUCP> Distribution: net Organization: [Consultant], Foster City, CA Lines: 25 +--------------- | ss@wanginst.UUCP (Sid Shapiro) writes: | > So I cheerfully set off to try and figure out how to capture the pid | > that is returned when you type foo& | In sh, on the other hand, you need only type: (foo&) 2>foo.pid | Mark Brader +--------------- In the Bourne Shell (either Edition 7 or 4.1bsd) the (parent) shell variable "$!" contains the process number of the last background process evoked. You don't need to write it into a file. Try: $ foo & $ ... # anything but another background invocation $ echo $! It works as documented. See "sh(1)". Rob Warnock Systems Architecture Consultant UUCP: {ihnp4,ucbvax!dual}!fortune!redwood!rpw3 DDD: (415)572-2607 USPS: 510 Trinidad Lane, Foster City, CA 94404