Contents of file named script


#!/bin/bash
# create a SAC macro to rotate the data,
# and save in /tmp
cat << END > /tmp/RotateMacro
   r N.SAC E.SAC   ; * load the data 
   rotate to gcarc ; * rotate to R-T
   w R.SAC T.SAC   ; * write out
   quit
END
# outer (station) loop
for station in UB/UB?? 
do
   cd $station
   # inner (event) loop
   for event in EV?? 
   do
      cd $event
      echo "Rotating " $event " for " $station
      # run SAC
      sac /tmp/RotateMacro > /dev/null
      cd ..
   done
   cd ../..
done
# End of script.