Re: Directory name problem...

Slava Pestov (slava_pestov@geocities.com)
Mon, 26 Oct 1998 16:37:40 +1300


> Tim Smith writes:
> :>> % 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.

Actually, what happends is XYZZY will equal a null string.
find "" |sort -ru will give you a list of all files from
the current directory. Each one of those files will be rm -fr'ed.
If the current directory is /, *ROFL*.

Slava

-- 
 Slava Pestov -- mailto:slava_pestov@geocities.com
http://www.geocities.com/SiliconValley/Heights/7925
    Linux 2.1.125 -- i586MMX -- 400.59 BogoMips

- 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/