#!/usr/bin/ruby def killevery(victim, options) processes = `ps -A | grep #{victim}`.scan(/(\d+) .*/) if processes.length > 0 puts "Killing #{processes.length} processes named #{victim}" processes.each { |p| print `kill #{options} #{p}` } else puts "No processes are named #{victim}." end end if $*.length < 1 puts "Kill every process named . Takes the same parameters as killall" else killevery($*.pop, $*.join(' ')) end