May you convert this tiny code to Bash code :
user/bin/perl sleep(300); system("killall -9 perl &"); sleep(5)
Thanks in Advance .
May you convert this tiny code to Bash code :
user/bin/perl sleep(300); system("killall -9 perl &"); sleep(5)
Thanks in Advance .
The perl program will kill not only all other perl processes, but also itself, so the functional equivalent translation would be something like
#!/bin/bash
sleep 300
killall -9 perl &
kill -9 $$ &
sleep 5
The final sleep 5
is probably never executed in the original script or in this one, although it is possible that the sleep command at least starts to execute.
If the reason behind translating into bash is exactly that, i.e. the program is supposed not to commit suicide, the other answers are better.
As Dennis Williamson said, in either case, your script should probably not use kill -9 and generally not globally kill, but it depends on your environment if it may have bad side effects.