maart@cs.vu.nl (Maarten Litmaath) (12/15/88)
mikej@tfli.UUCP (Michael R. Johnston) writes: \In article <733@iraun1.ira.uka.de> schuetz@iraul1.ira.uka.de (Elmar Schuetz) writes: \>I want to "kill -9" the latest submitted job in a csh-environment. \>I mean the job with the highest number. Note, this is not always "%+". \NOTE: Your last process does NOT necessarily have to be the highest numbered \process attached to your tty. In particular processes wrap around after \a certain point and start from the bottom again. Elmar was talking about the highest JOB NUMBER, not process id: % jobs -l [1] 29479 Stopped nn [2] - 29617 Stopped vi pipo [3] + 29622 Stopped cat > foobar ^ job number -- fcntl(fd, F_SETFL, FNDELAY): |Maarten Litmaath @ VU Amsterdam: let's go weepin' in the corner! |maart@cs.vu.nl, mcvax!botter!maart
schuetz@iraul1.ira.uka.de (Elmar Schuetz) (12/16/88)
In article <1811@solo9.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >mikej@tfli.UUCP (Michael R. Johnston) writes: >\NOTE: Your last process does NOT necessarily have to be the highest numbered >\process attached to your tty. In particular processes wrap around after >\a certain point and start from the bottom again. >Elmar was talking about the highest JOB NUMBER, not process id: Sorry Maarten, Michael is right. I think he is talking about job-numbers too. Let's start as much 'sleep 999 &'s as possible ... Anytime comes the message: "No more processes." Let's kill the jobs [2] to [8] and do a 'jobs -l'. The result: [1] + 1221 Stopped rn -N [8] 1609 Killed sleep 999 [9] 1610 Running sleep 999 [10] 1612 Running sleep 999 ... [ [11] to [48] deleted ] [49] 1652 Running sleep 999 [50] - 1653 Running sleep 999 Now let's start another three 'sleep 888 &'s. And see, their job-numbers are [2], [3] and [4]. [1] + 1221 Stopped rn -N [2] 1660 Running sleep 888 [3] 1661 Running sleep 888 [4] 1662 Running sleep 888 [This *is* the latest job !!! ] [9] 1610 Running sleep 999 [10] 1612 Running sleep 999 ... [ [11] to [48] deleted ] [49] 1652 Running sleep 999 [50] - 1653 Running sleep 999 Well, [4] is not the highest number at all. But normally this won't happen. Cheers, Elmar -- My VAX might think I'm crazy starting so many useless 'sleep's.