#!/bin/bash


#< convenience
#set -e
function error () {
    echo $*
    exit 1
}

function usage () {
    echo "usage: $0 [-o option] [-n] arguments";
    exit 0
}
function help () {
cat <<EOF
 put more extensive help text here.
EOF
}

notreally=
function doit () {
    echo "$*"
    if [ $notreally ]; then return; fi
    eval $* || error "Failed."
}

function tryit() {
    echo "$*"
    if [ $notreally ]; then return; fi
    eval $* || echo "WARNING: Failed. Continuing..." && return -1;
    return 0;
}
ARGS=
function parseopts () {
    while true ; do
        case "$1" in

            '') 
                break
                ;;
            -h | --help) 
                help
                exit 0 
                ;;
            -n | --notreally)
		notreally=1
		shift
		;;
	    -o | --option)
		opts[$2]=1
		shift 2
		;;
	    *)
		ARGS="$ARGS $1"
		shift
		;;
	esac
    done
}
#> 

parseopts $@
for f in $*; do
    for p in "./" "./.l-" "./Thumbs/"; do
	doit convert -rotate -90 "$p$f" "${p}foo"
	doit mv "${p}foo" "$p$f"
    done
done

