A check added to prevent infinite loop while detecting shell prompt. A line of code uncommented to avoid preventing shell prompt ref #340