echo "Taking ScreenShot"

run() {
        arr=()
        number=$1;
        #echo "$number"
        shift
        for n in $(seq $number)
                do
                        arr+=" screenshot$n.jpg"
                done
        #echo $arr
        screencapture -x $arr
}

cd "/Library/Application Support/adxba/unity/unity_service/screenshots"

COUNT=$(system_profiler SPDisplaysDataType | grep -c Resolution)

if [ "$COUNT" != "1" ]; then
  mkdir parts
  cd parts
  run $COUNT
  echo "multi"
elif [ "$COUNT" == "1" ]; then
  screencapture -x screenshot.jpg
fi