Imagine I have a script foo. It should be run once when the user logs in and isn't needed after a successful run.
My question: Is it safe to remove the script file from within the script?
E.g.:
#!/bin/bash
# do something
...
# if successful
rm /path/to/foo
exit 0
#!/bin/bash -eto ensure that the script file is removed only if nothing goes wrong. – sr_ Feb 29 '12 at 10:30