I have files whose extension is .AH. For example:
aa.AH
bb.AH
cc.AH
dx.AH
tmz.AH
lght.AH
I want to select all of these files, but not one by one because I use saclst (it's a command to read and write seismogram headers), and it needs all files for comparison for NPTS (which is the number of points).
So I use this code:
for file in *AH
do
nptsAH=$(saclst npts f ${file}* > nptsAH.txt | awk '{print $2}' nptsAH.txt | sort -n | head -1)
declare -i nptsAH
sac << !
r $file
interpolate NPTS $nptsAH
w over
q
!
done
Which form is correct for bash scripting?