Hello Lovely Monks, I have snippet of code I created to kill user processes. We were to put the processes of a specified user into an array and kill them off one by one. I have the script working with no errors and it is killing off the processes. However I'm getting a system return that is kicking me out of my do-while loop. Not sure why this is happening. Some guidance would be appreciated. This subroutine takes place after I find the user's processes and have already written them to the array and printed the array.
sub kill_process{ do { print"Kill processes for the user (y orn?\n"; my $ans = <>; chomp $ans; print "choose pid: "\n; my $pid =<>; chomp $pid; system `kill $pid`; print "process killed \n"; }while ($ans eq "Y" || $ans eq "y"); },
forgot to show the sytem return message IPC::System::Simple::run called with no arguments at testarray_perl line 52. Line 52 is the system kill line.
In reply to Killing processes by deyaneria
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |