4

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
  • 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
    Commented Jun 13, 2014 at 6:55

1 Answer 1

7

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
2
  • 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
    Commented Jun 15, 2014 at 7:34
  • Yes I added a brief note, but it is a separate question. So just something to help you get started. Commented Jun 16, 2014 at 8:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .