>:>> % Q> #!/bin/sh
>:>> % Q> XYZZY="`find / -name core`"
>:>> % Q> for LOOP in `find $XYZZY | sort -ru` ; do
>:>> % Q> rm -fr $LOOP
>:>> % Q> done
>:>
>:>You know, interesting things will happen when he runs that script
>:>and there are *not* any files named core around...
>
>Nothing interesting happena as
>rm -rf
>as itself does nothing and won't give any error message.
Really? Speaking from running it with no cores around? Or just
speculation?
The first line XYZZY="..." would get replaced with "" so XYZZY
is blank. The second line then says:
for LOOP in `find | sort -ru` ; do
Because XYZZY is blank, the find command has no argument, and as
such it will "find" every single file on the entire disk that is
in a subdirectory of the current directory. As such, if the
person running the script is in the root directory, then it will
find every file on the entire system. Subsequent to that, the
files will all be erased.
Be more careful next time you evaluate such a script like this.
-- Mike A. Harris - Computer Consultant - Linux advocateLinux software galore: http://freshmeat.net
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/