/bin/sh feature? --- more lossag

ajs ajs at hpfcla.UUCP
Sun Jul 15 08:07:00 AEST 1984


> Yes, the backquote in inline input redirecton is active; it will try to
> execute the hi command and lose.  Sigh.

Just for your  amusement,  a worse  example of the same thing.  Before I
knew about quoted here-documents (who has time to reread the manual?), I
wrote a shell script  that, among other  things, did an "at" from a here
document.  In the document was a line like:  "rm -rf $dir/*".

Now, $dir would be set when the at script  (actually a shell  script, of
course)  ran, but it was not set at the time that I ran the first  shell
script.  Furthermore,  I did not  have set -u in  effect,  and I ran the
shell script as root.

Naturally  the  shell  evaluated  $dir to "".  It was pure  luck  that I
looked at the  queued at script  before it removed  all the files on the
disc.  Nearly passed out when I saw:  "rm -rf /*"  in it.

-- Alan (always quote your here documents) Silverstein



More information about the Comp.unix.wizards mailing list