#!/bin/bash
#==============================================================
# bpmSetValCavUndsAtca
#
# Facility:  SLAC/LCLS
#
# Write a value to a PV for all UNDS cavity ATCA BPMs
#
# Usage: bpmSetValCavUndsAtca <attr> <value>
#
# Arguments: 
#        
#==============================================================

# Check for input arguments
if [ $# != 2 ]
then
    echo "Missing argument(s). Quitting"
    exit 1
fi

attr=$1
value=$2

# Lists of affected BPMs
bpms="
BPMS:UNDS:1690
BPMS:UNDS:1990
BPMS:UNDS:2190
BPMS:UNDS:2490
BPMS:UNDS:2590
BPMS:UNDS:2690
BPMS:UNDS:2790
BPMS:UNDS:2890
BPMS:UNDS:2990
BPMS:UNDS:3090
BPMS:UNDS:3190
BPMS:UNDS:3290
BPMS:UNDS:3390
BPMS:UNDS:3490
BPMS:UNDS:3590
BPMS:UNDS:3690
BPMS:UNDS:3790
BPMS:UNDS:3890
BPMS:UNDS:3990
BPMS:UNDS:4090
BPMS:UNDS:4190
BPMS:UNDS:4290
BPMS:UNDS:4390
BPMS:UNDS:4490
BPMS:UNDS:4590
BPMS:UNDS:4690
BPMS:UNDS:4790
BPMS:UNDS:5190
"

for i in ${bpms}
  do
  caput ${i}:${attr} ${value}
done

exit 0

