be safe. Exit on error, fail correctly with pipes and exit on using a unset var
Cat over top of existing jpeg file to preserve permissions
Move to using a ${@} arg loop
Move to standard if format with then on next line, use {} for all vars, cat over top of orig file to preserve permissions rather then chmod/chown.
Fixes #6, this adds back in bsd/os x support.
Formatting fixes