Is there a more compact form of killing background jobs than:
for i in {1..5}; do kill %$i; done
Also, {1..5} obviously has a hard-coded magic number in it, how can I make it "N" with N being the right number, without doing a:
$(jobs | wc -l)
I actually use \j in PS1 to get the # of managed jobs, is this equivalent?
kill $(jobs -p)seems easier. – jw013 Jul 19 '12 at 22:00for pid in $(jobs -p); do kill $pid; done? – jw013 Jul 19 '12 at 22:27jobswhich only works if the jobs happen to be numbered consecutively. Oh, and “kill jobs individually” is meaningless: passing multiple PIDs to thekillcommand does exactly the same thing as passing them separately. – Gilles Jul 19 '12 at 23:52