2

I would like to have the Konsole title changed every time I run a loop, like this:

while read line; do
  echo $line $i/$numline
  echo -ne "\033]0;$line $i/$numline\007"
  commands
  let i=i+1
done<text

I've found that the echo -ne "\033]0;text\007"command doesn't work.

  • 1
    the escape sequence looks fine. it should set you title correctly. maybe your prompt configuration resets your title afterwards. try echo -ne "\033]0;foo\007";sleep 3 this should change you title and after three secondsyour prompt should set it back. – michas Jun 13 '14 at 6:55
6

You need to first go to settings of konsole:

settings -> configure current profile -> Tabs -> Tab title format = %w

The konsole by default ignores what is asked for, it does its own thing, as configured. %w tells is replaced by what ever the shell wants it to be. There are other codes, use the insert button it knows all the codes.


A brief note on getting the shell to take over from what the terminal emulator was doing.

I have this is my ~/.bashrc it updates the title. You may have to do more research into bash variable PS1, or look at variable PROMPT_COMMAND.

case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac
  • This works. However I would like to have the old title whenever I don't run any scripts. Is it possible to manually change the tab title format in command? Thank you. – Ooker Jun 15 '14 at 7:34
  • Yes I added a brief note, but it is a separate question. So just something to help you get started. – ctrl-alt-delor Jun 16 '14 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.