#!/bin/bash
MINPARAMS=3

if [ $# -lt "$MINPARAMS" ]
then
  echo
  echo "Syntax: $0 camera(red|blue) exptime title [nloop]"
  exit 0
fi 

camera=$1
exp=$2
target=$3
nloop=1
if [ -n "$4" ]
then
 nloop=$4
fi 

  echo "setting PA positions"
  qwpa1=87.00
  qwpa2=177.00

count=0

while [  $count -lt $nloop ]; do
   echo The counter is $count
   echo "starting exposure  number "$count" of "$nloop
   echo "using camera $camera" 
   qwp $qwpa1
   run $camera $exp $target"@"$qwpa1 
   qwp $qwpa2
   run $camera $exp $target"@"$qwpa2 
   
   let count=count+1 
done

bell

