after termination console state is restored. stty for the rescue!; +other edits