4

After running a bash script, my (gnome-)terminal ended up printing each new line where the last one ended (but on the next row). I think it was printf that broke things, since it works if I replace printf with echo. Have you any idea what this could be, and how to fix it without having to close the terminal session?

Broken newlines

I can not provide the script, because of security reasons. When I have time I will see if I can create a minimal broken example to show.

lindhe
  • 4,096
  • 3
  • 20
  • 34
  • 1
    Most likely something in your script changed stty settings. If you log out and back in in should be okay. Or type `stty sane^J` (^J meaning ctrl-j) at the command line. – Deathgrip Jan 18 '18 at 07:22
  • as well as the answers in the dupe link, many terminal emulators have a "Reset" option in a right-click menu, or in the Edit menu. – cas Jan 18 '18 at 07:49
  • 2
    type 'reset' in the terminal – rajaganesh87 Jan 18 '18 at 08:33
  • `reset` works, but then I lose history. I thought it started a whole new session, tbh. – lindhe Jan 18 '18 at 08:36
  • 2
    @lindhe, I don't think the command called `reset` does anything other than print some control codes to reset the terminal, it shouldn't affect the shell's history. It does clear the screen, though, but with garbage like that on-screen, that shouldn't matter. – ilkkachu Jan 18 '18 at 09:45
  • 2
    _This isn't control codes. This is the line discipline_, and the duplicate questions are in fact https://unix.stackexchange.com/questions/366423/ , https://unix.stackexchange.com/questions/298037/ , https://unix.stackexchange.com/questions/282514/ , and https://unix.stackexchange.com/questions/346363/ , amongst others. This has been asked and answered many times. – JdeBP Jan 18 '18 at 10:35

0 Answers0