self-deleting shell script

后端 未结 4 2132
予麋鹿
予麋鹿 2021-01-30 10:43

I\'ve looked around for an answer to this one but couldn\'t find one.

I have written a simple script that does initial server settings and I\'d like it to remove/unlink

4条回答
  •  野性不改
    2021-01-30 11:03

    rm -- "$0"
    

    Ought to do the trick. $0 is a magic variable for the full path of the executed script.

提交回复
热议问题