To keep track of which ssh connection I have open in different tabs I use the following ~/.bashrc script:
function set-title() {
if [[ -z "$ORIG" ]]; then
ORIG=$PS1
fi
TITLE="\[\e]2;$@\a\]"
PS1=${ORIG}${TITLE}
}
set-title <SERVERNAME>;
echo "set-title <SERVERNAME>"
I do this for my tabs that I don't have ssh open (with set-title LOCAL;
) and on two different servers. On one server it does exactly what I want to do and changes the tab name, but on the other server it does not change.
When I type set-title <SERVERNAME>;
on the command line myself it does change the tab name, and when logging in it does echo "set-title <SERVERNAME>"
. Also, if I do source ~/.bashrc
it works as expected, so it is only when logging in to the server that it does not work.
On the server where it works on login runs Scientific Linux release 6.7 (Carbon)
, on the server where it does not work runs CentOS release 6.6 (Final)
. What could cause the set-title <SERVERNAME>;
in the .bashrc script to not run correctly on login?