I followed unix s.e post and added the line,
trap 'echo -ne "\033]0;$BASH_COMMAND\007"' DEBUG
to my .bashrc
file to set my last command as the terminal title. It works good on my ubuntu desktop machine.
When i add this line to my Centos server's .bashrc
file and ssh into the Centos machine, it no longer works. SSH client terminal title has become blank and it prints all junk stuff on my console after every command,
Last login: Sun Jun 7 21:28:29 2015 from sk-box
]2;printf "k%s@%s:%s]0;printf "k%s@%s:%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"[root@sk-vbox ~]# cd
]2;printf "k%s@%s:%s]0;printf "k%s@%s:%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"[root@sk-vbox ~]# pwd
/root
]2;printf "k%s@%s:%s]0;printf "k%s@%s:%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"[root@sk-vbox ~]#
Is it possible to ensure that dynamic title works well over ssh?
.bashrc
or an old bash version that doesn't have a feature you rely on. What version of bash is the server running? What else is in your.bashrc
? – Gilles 'SO- stop being evil' Jun 07 '15 at 23:49.bashrc
&/etc/bashrc/
files are there at - https://github.com/madhavan020985/local-rc/tree/master/centos-7. I am suspicious, if this line that sets thePROMPT_STRING
- https://github.com/madhavan020985/local-rc/blob/master/centos-7/etc-bashrc#L22 and if i changed it by mistake. – Jun 08 '15 at 00:524.2.46
– Jun 08 '15 at 01:03