Replaced expr by bash substringing.