#!/bin/bash set -euo pipefail IFS=$'\n\t' SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Last two lines of the log file were added to produce an error state while IFS=' ' read -r pv val; do echo "caput ${pv} ${val}" caput ${pv} ${val} > /dev/null 2>&1 sleep 4 done < <(cut -d' ' -f 1,4 "${SCRIPT_DIR}/beamstop.log")