For When You Can't Have The Real Thing
[ start | index | login ]
start > Adventures In Bad Ideas

Adventures In Bad Ideas

Created by dave. Last edited by dave, 10 years and 184 days ago. Viewed 2,031 times. #2
[diff] [history] [edit] [rdf]
Pop quiz for all those hackers out there: what's wrong with this command? Besides the fact that it was run from cron in the middle of the night as root, I mean. (Broken up into multiple lines for readability -- it was originally issued as one monster command from cron.)
here# rsh there 'cd /projects/team/task/results ; \
    for i in * ; do \
    if [ ! -h /net/here/projects/team/task/result/$i ] ; then \
    echo Removing /projects/team/task/results/$i ; \
    rm -rf $i & \
    fi ; \
    done ' &

Hint: The 'cd' is the fatal flaw. Why?

Ouch. Ouch ouch ouch ouch

The good news is that the backups work properly. :)

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt