#!/bin/bash
set -eo pipefail

while getopts ":f:j:" options; do         # Loop: Get the next option;
                                          # use silent error checking;
                                          # options n and t take arguments.
  case "${options}" in
    f)
      FUNC_NAME=${OPTARG}
      ;;
    j) 
      FILE=${OPTARG}
      ;;                                  # 
    
  esac
done

while true; do
   aws lambda invoke --function-name ${FUNC_NAME} --payload fileb://${FILE} out.json 
   cat out.json
   echo ""
   sleep 10
done
