Re: script that remove itself



learnq <learnq@xxxxxxxxx> wrote:
Hi,

I am new to shell script . Is it possible to write a script that delete
itself after running .
means suppose i have a script in /usr/src/script.sh when i run the
script it will do the
job and when the script finish it will remove itself .

Hope it is clear .please help me .

Thx.

In ksh,

export F1=`mktemp`
cp /usr.src.script.sh $F1
chmod 700 $F1
$F1

I use this all the time with scripts I build on-the-fly.
Note this avoids problems with file name collisions.
--
Using OpenBSD with or without X & KDE?
http://dfeustel.home.mindspring.com
.



Relevant Pages

  • Re: [kde] Log off script
    ... other than the KDE GUI, thats the standard all machines are installed with. ... I can modify the startkde script to copy from server ... The startup MUST be a shell script with the 'sh' ... The shutdown can be any executable and they can be in a subdirectory: ...
    (KDE)
  • Re: pop-forum Re: poplog-dev A look at Poplog on the Macintosh
    ... with the poplink command. ... When trying to make pglink produce a 'sh' rather than a 'csh' shell ... script for linking and when trying to make it put unexpanded environment ... using the shell script pglibr, ...
    (comp.lang.pop)
  • Files appear to be cross linked
    ... script requires a number of standard environment variables to be set ... so it calls a second shell script to set these at the session level, ... control should return to the first shell script, ... that the script executes to the last line prior to the displaying of ...
    (comp.unix.solaris)
  • Re: [PHP] Catch STDERR
    ... into your PHP script? ... Or do you just need STDOUT in one variable, and STDERR in another, ... Another option is to try to write a .sh shell script to get what you ...
    (php.general)
  • Re: basic questions
    ... Setting a script that runs at 3:00 ... Set chron to run that shell script. ... Debug the GUI application with the REPL. ... You start up the Web browser, then browse the Web, visit a hundred ...
    (comp.lang.lisp)