Saturday, August 13, 2011

A Fun Code Snippet

I was poking around in old Cyclopath scripts I'd written and came across this gem:

if [ `hostname` = $PROD_HOST -a $dest_db = $PROD_DB ]; then
    echo
    echo "WARNING WARNING WARNING!!!"
    echo "You are about to destroy the production database!"
    echo
    echo "Are you sure you want to DESTROY THE PRODUCTION DATABASE!?"
    echo
    echo "If you really want this, type 'destroy the production database'."
    echo
    echo -n "> "
    read sure
    if [ "$sure" != "destroy the production database" ]; then
        echo "Aborting."
        exit 0;
    fi
fi

Or, I thought it was funny at least. :)

No comments:

Post a Comment