VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Secure Shell (https://forums.vandyke.com/forumdisplay.php?f=15)
-   -   tabs renamed automatically? (https://forums.vandyke.com/showthread.php?t=3875)

GKnight 09-12-2009 08:35 AM

tabs renamed automatically?
 
Something's been bugging me for a while. I've been suing SecureCRT 5.5 and when I connect to some linux servers, the tab name automatically changes to the command prompt. This sometimes gets really annoying as I may have long current directory names and the tabs get too wide and start pushing other tabs off the screen. Is there a way to turn this off?

miked 09-12-2009 10:17 AM

The server is sending window title change requests. That's the real cause of the problem. You could disable that by setting your prompt in one of your initialization files (.bash_profile, .tcshrc, etc.).

SecureCRT does provide an option to ignore the window title change requests. If you enable the option to Ignore window title change requests in Session Options / Terminal / Emulation / Advanced, does that fix the problem?

GKnight 09-19-2009 10:34 AM

Quote:

Originally Posted by miked
SecureCRT does provide an option to ignore the window title change requests. If you enable the option to Ignore window title change requests in Session Options / Terminal / Emulation / Advanced, does that fix the problem?

Thanks! That setting did the trick. No more annoying tab name changes!

What exactly triggers the window title change? Some of my linux servers do it while some don't, I can't quite figure it out by looking at the profiles or env settings. It's only happening on the linux servers.

jdev 09-19-2009 04:07 PM

Quote:

Originally Posted by GKnight
What exactly triggers the window title change? Some of my linux servers do it while some don't, I can't quite figure it out by looking at the profiles or env settings. It's only happening on the linux servers.

When SecureCRT receives the following escape sequence, it changes the window title:
ESC]2;titleBEL
(By BEL, I mean ASCII(7)).

What's likely happening is that the shell prompt on your Linux machines is configured to send the escape sequence as part of displaying the command prompt. If you're running a bash shell on your Linux machines, it's likely that either the PS1 or PROMPT_COMMAND environment variables are responsible for sending the window title change request to SecureCRT.

You can play around with this if you want to experiment. For example, you might want to set up your remote startup scripts to always set the tab title to the remote hostname to which you are connected. Here's an example command you can run to change your window prompt (assuming the Session option to Ignore window title change requests is not enabled):
echo -ne "\033]2;This is my new window Title\007"
To set your prompt to the hostname of the Linux machine to which you are connected, you might use the following as an example:
echo -ne "\033]2;`hostname`\007"
Or, to set your prompt to the IP address of the Linux machine to which you are connected, you could use the following command:
echo -ne "\033]2;`ifconfig eth0 | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`\007"

--Jake

GKnight 10-19-2009 10:17 AM

Thanks for the detailed explanation! I checked, and sure enough, I found this in the /etc/bashrc file:

Code:

PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
No big deal anymore as I enabled the "ignore the title change" option. But good to know for the future, in case I need some servers to set the tab name.

adudek 07-15-2014 10:00 AM

how do do this in other shells?
 
I noticed that the cmds you gave only work on bash.
what about tcsh, csh, or zsh?

Thanks

jdev 07-15-2014 01:46 PM

Quote:

Originally Posted by adudek (Post 41938)
I noticed that the cmds you gave only work on bash.
what about tcsh, csh, or zsh?

As I think back to where I was 4+ years ago, I don't think it was my intention to provide comprehensive examples for other shells. I'm most comfortable in sh/bash, and use it rather than tcsh/csh/zsh wherever possible. The post was designed to explain why the title might have been changing and give a related example or two.

What problem are you trying to solve, Aaron?

--Jake


All times are GMT -6. The time now is 04:36 AM.