There won't necessarily be a newline on the end of text entered into stdin, the FAQ demonstrates a good method on determining if there is - and to remove it if it's there.