in reply to Deleting a file after it runs?
On unix, you can also say,
You can say that at any point in the program, and unix will go ahead and remove the file from the directory without losing the object of the file handle. The removal is completed and disk space released once your program closes.unlink $0;
$ cat > try.pl #!/usr/bin/perl print $0, $/; unlink $0; print "Feeling faint . . .\n"; $ chmod 755 try.pl $ cp try.pl try.bak $ ls try.* try.bak try.pl $ ./try.pl ./try.pl Feeling faint . . . $ ls try.* try.bak $
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Deleting a file after it runs?
by liverpole (Monsignor) on Oct 06, 2005 at 21:57 UTC | |
by Tanktalus (Canon) on Oct 07, 2005 at 03:40 UTC | |
by liverpole (Monsignor) on Oct 07, 2005 at 16:34 UTC | |
by Hue-Bond (Priest) on Oct 07, 2005 at 19:44 UTC |