summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmkill
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/dmkill')
-rwxr-xr-x.local/bin/dmkill11
1 files changed, 6 insertions, 5 deletions
diff --git a/.local/bin/dmkill b/.local/bin/dmkill
index 521f315..9c7c838 100755
--- a/.local/bin/dmkill
+++ b/.local/bin/dmkill
@@ -29,7 +29,6 @@ sub confirm
sub action
{
my ($var, $user) = @_;
- my @split;
my $pid;
my $proc;
@@ -37,10 +36,12 @@ sub action
if (not $var) {
return;
}
- @split = split / $user /, $var;
- $pid = $split[0];
- $pid =~ s/\D//g;
- $proc = (split / /, $split[1])[0];
+ if ($var =~ /^\s*(\d+)\s/) {
+ $pid = $1;
+ }
+ if ($var =~ /^\s*\S+\s+\S+\s+(\S+)/) {
+ $proc = $1;
+ }
if (confirm($pid, $proc) == 1) {
exec(KILL_PATH, '-9', $pid);
}