I would like my script to remove itself automatically since its work is done. I have added the line below to the end of my script:
unlink($0);
For some reasons, it’s not working. Could you please advise what I should do? Probably, there is another approach or I could add an error message to find out why it’s not removed?
Thank you.
I don’t know why you can’t. It works in my machine. Maybe your file system locks the file when it’s running.
And you please try this:
which replace the current Perl process with the
rmone. This should release your script and has it removed.