Can a shell script delete or overwrite itself?

Viewed 13590
#beginning of bashscript1.sh
source bashscript2.sh
echo $variable

and here is the source file:

#beginning of bashscript2.sh
rm -f bashscript2.sh
variable = "integer of some kind"

How will the bash script be handled? Does it first load the source file and then deletes it, or will the variable have a value in bash script 1?

2 Answers
Related