#!/usr/bin/bash
#####################################################################
# WARNING: This script made by a complete stranger - use at own risk.
#
# Usage:
# wget this file using url
# After download run: chmod +x eps_to_png
# Run script inside directory of eps files
# ./eps_to_png
#
# IMPORTANT: Do not add .sh as a file extension
# sh is NOT bash; it is a POSIX or Bourne shell. To run bash code, your script MUST use a bash shebang, 
#+ and it MUST be executed directly or with bash (NOT sh myscript). 
#+ Sometimes /bin/sh symlinks to bash, but you can't rely on this and it will 
#+ disable many bash features. <http://mywiki.wooledge.org/BashGuide/Practices#Choose_Your_Shell>
#
# This script will convert a directory of eps files to png
#+ using inkscape
# Size: 2048 x 1536
#
# The more savvy can comment/uncomment the appropriate lines to use find
#+ find /path/to/dir -iname "*eps" -exec ./eps_to_png '{}' \;
# CAVEAT EMPTOR: Using find for this script will place all files in current
#+ directory of the running script unless you know how to remediate that.
#
# No further help will be provided by author. Good luck!
#####################################################################

#find_file="$1" # uncomment this line if using find 

eps_files=(*eps) # comment this line if using find
for find_file in "${eps_files[@]}" # comment this line if using find
  do # comment this line if using find
    inkscape -f "$find_file" -w2048 -h1536 -e "${find_file%eps}png" 
  done # comment this line if using find

exit 0
