I am trying to use flags to set an output file for my bash program. I would like to make it possible in case I havent expliticly entered arguments to use stdout. Additionally, I set number of iterations. In case I do not provide this flag, I would like to set it to 3.
This is what I have:
while getopts i:o: option
do
case "${option}"
in
i) ITERATIONS=${OPTARG};;
o) OUTPUTF=${OPTARG};;
esac
done
docker-compose up -d
for i in {1..ITERATIONS}
do docker-compose run specs | tee OUTPUTF
sleep 1
done
docker-compose stop