improve shell variable expansion