Kill a process from perl script

后端 未结 4 532
自闭症患者
自闭症患者 2021-01-19 05:53

I am trying to kill a process by name which i will pass as a variable to a system command.

Below is what i have:

my $processName=$ARGV[0];
print \"$         


        
4条回答
  •  我在风中等你
    2021-01-19 06:31

    You have the different variables $processName and $jobName, so the whole ` ` expression ends up empty. use strict would have pointed that out; it's useful even for three-line scripts. The kill error message is what you get when you run it without any arguments.

    Pro tip: pkill exists, you can replace the whole problematic hack with one command.

提交回复
热议问题