#!/bin/lua

if #arg > 1 then
    for i = 1, #arg - 1 do
        local status = os.request("1", "kill", arg[i])

        if status == 0 then
        elseif status == 127 then
            print("kill: (" .. arg[i] .. ") - No such process")
        else
            print("kill: (" .. arg[i] .. ") - Operation not permitted")
        end

        if status > 0 then
            os.exit(status)
        end
    end
else
    print("kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]")
    os.exit(2)
end