Not sure if this is even possible, but I'd like to set the last line of my terminal output to be the title of that window.

I've seen this, which sets the last command as the title, but I'm interested in seeing the most recently outputted line as the window title.

Eg if I run:

echo "Hello World" && sleep 2 && echo "Goodbye World" && sleep 2

then I want the window title to be "Hello World" for 2 seconds, then "Goodbye World" for 2 seconds, then set back to my bash prompt.

I'm interested in doing this, so I can see if a terminal needs user input after I've shaded it. Eg so I can see that I need to input [y/n] to continue with an update. This is so I don't have my terminal window in my way, but I'm still aware of what's going on without having to consciously switch to its full window.

I'm using Konsole in case that's of any use.

  • 1
    Is the output always coming from echo or could it be anything? What about commands which produce multi-line output (e.g. ls -l)? – nohillside Jan 9 at 21:38
  • I wonder what happens if you cat a binary file by mistake. :3 Since you use KDE, can't you rather look at Konsole's bell settings and b) wrap the long-running commands in a script which would call notify-send for you? – Roman Grazhdan Jan 9 at 21:48
  • @patrix I'm just interested in whatever the bottom line is. But for ls -l it runs too quickly anyway, so it would just show the bash prompt presumably. But if I were to run ls -l && sleep 2 then it should just show the last line outputted by ls -l for 2 seconds, then switch back to the bash prompt. @R – Andrew Barabas Jan 9 at 22:23
  • @RomanGrazhdan that's probably simpler, but wouldn't I have to do that for every long-running command? I'll see what I can find out about that. (Sorry for the double commenting, I keep pressing enter accidentally) – Andrew Barabas Jan 9 at 22:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.