mercredi 21 septembre 2016

comparing a number with a variable in shell if command

I have a variable that I am storing as

upstream_introngap=$(awk '$3==$start-1 && $4 ~/$geneid/' File | awk '{print $3-$2}') 

and using it in the code as

if [ "$upstream_introngap" -lt "100" ] ; then
    condition

However I am getting an error

[: : integer expression expected

I am trying different combinations but I am unable to get the right comparison expression, is the problem here the variable or the expression/number that is being compared with?

Aucun commentaire:

Enregistrer un commentaire