OK i am sure this is an easy question but I am having trouble finding the answer. All I am trying to do is have an if statement that says if $stla is greater than -25 or $stla less than -16. I am pretty sure it is just a syntax thing but I am new to bash and havn't had much luck Googling the answer.
I attached my whole script, the variable assignment seems to be working, so you should need to worry about that. If I disable the if statement and just have echo $stlo it will print every $stlo, so I think the variables are correct.
Right now I just have if ["$stla" -lt "-25"] which returns "line 10: [33.63: command not found" So it is treating $stla as a command and not a number. How do I correct that? And once that is corrected how can I make a or condition to include greater than -25?
Sorry for the simple question, let me know if I need to clarify anything.
#!/bin/bash
for file in *.SAC; do
stla="$(saclst stla f $file)"
stla=(`echo $stla | awk '{print $2}'`)
stlo="$(saclst stlo f $file)"
stlo=(`echo $stlo | awk '{print $2}'`)
if ["$stla" -gt "-25"]
then
echo $stlo
fi
done