Modified if statement to use double brackets

Single brackets were causing problems so bash extended conditional
expression is used instead.