#!/bin/bash
# outer (station) loop
for station in UB/UB??
do
# inner (event) loop
for event in $station/EV??
do
# create SAC macro
echo $event
echo "r "$event"/N.SAC "$event"/E.SAC" > /tmp/RotateMacro
echo "rotate to gcarc" >> /tmp/RotateMacro
echo "w "$event"/R.SAC "$event"/T.SAC" >> /tmp/RotateMacro
echo "quit" >> /tmp/RotateMacro
# run SAC
sac /tmp/RotateMacro > /dev/null
done
done
# End of script.