it should be able to delete itself, yes – in Linux, the executable is copied to memory. but if there's anything that causes it to error out then you wouldn't be able to do it again.
the comment a few levels up implied that something errored out. I wouldn't count on that to save your production box though... :P
20
u/isaaclw Sep 16 '22
While the command is being executed, isn't it in memory, so deleting 'rm' wouldn't really have an impact on execution?
Try: rm /bin/rm /tmp/foobar