Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Secure Shell

Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2011, 08:51 AM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Tab/Title bar not changing on logout

Hi!
I'm using
echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD/#$HOME/~}\007"
to set my tab/title bar and it works fine when I login to a machine and then ssh to a second machine from there but when I log out of the second machine the title isn't reset - any idea why?

Cheers.
Reply With Quote
  #2  
Old 09-15-2011, 09:10 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi cbeck,

Thanks for the question. Are you issuing the command after exiting the connection to the secondary machine?

Have you added this prompt to your PS1 or PROMPT_COMMAND variables?

What version of SecureCRT are you using?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 09-15-2011, 09:36 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi cbeck,

Are you using Xterm for the emulation when connecting to the first machine?

What shell are you using?

I am asking these follow-up questions because this should work if you are using Bash for your shell on both machines, and you are using the Xterm emulation when connecting to the first machine.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #4  
Old 09-15-2011, 10:10 PM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Hi!
I'm using bash on both machines, Linux emulation. The echo line goes in my .bashrc just above the export PS1 command. You are suggesting that I embed the title set into the PS1?
Reply With Quote
  #5  
Old 09-16-2011, 07:27 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi cbeck,

Thanks for the information. At this point, I would suggest using the Xterm emulation for your first connection without making any other changes. This should allow you to see the behavior you want when exiting the second connection. The VT### or Xterm emulations are more for general use.

Is there some specific reason that you are using the Linux emulation?

Do you see the behavior you want if you change your emulation to Xterm, disconnect and reconnect?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #6  
Old 09-16-2011, 08:52 AM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Well, Xterm looses all of the colouring that was working in my previous setup.
My PS1 is:

export PS1="\[\033[1;30m\][\[\033[0;34m\]\u\[\033[1;30m\]@\[\033[0;35m\]\h\[\033[1;30m\]] \[\033[0;30m\]\w \[\033[1;30m\]\$\[\033[0m\] "

Can you offer advice on how to translate that into something Xterm friendly?

In addition, it doesn't seem to work - logging out of the remote ssh connection doesn't reset the tab or window title bar.

Cheers,
Chris
Reply With Quote
  #7  
Old 09-16-2011, 08:58 AM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Ah - when first chosing Xterm the colour box wasn't selectable but now it is - so the colours are working. But the title/tab still isn't.

Cheers,
Chris
Reply With Quote
  #8  
Old 09-16-2011, 09:08 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Chris,

I am glad to hear that you got the color working. Did you disconnect and reconnect your session after changing the emulation to Xterm?

If you did, have you configured Terminal type: to be something other than Xterm? This option is located in the Terminal / Emulation / Advanced category of the Session Options dialog.

When you run the test, if it is still failing after disconnecting and reconnecting the session, what is the value of the TERM environment variable?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #9  
Old 09-16-2011, 09:56 AM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Hi Todd,
Thanks for sticking with this. To answer your questions:

1) I closed the program and restarted it.
2) The terminal types list is empty and the checkbox isn't checked.
3) My TERM variable is xterm-color on the first machine, on the second, and on the first after I exit the second.

Both servers are running CentOS 5.6, if that makes a difference.

Cheers,
Chris
Reply With Quote
  #10  
Old 09-16-2011, 12:01 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
No problem Chris. I have not been able to reproduce the failure in my environment using your PS1 and PROMPT_COMMAND variables, so it looks like there is something in your environment that is preventing this default behavior from working as expected. Here is a list of steps that should be able to be used to get the behavior one expects when connecting to a remote using Bash as the shell and Xterm as the emulation:
  1. Set Xterm as the emulation for the session in SecureCRT.
  2. Make sure that Terminal type: is not enabled. This is located in the Terminal / Emulation / Advanced category of the Session Options dialog.
  3. Confirm that Ignore window title change requests is not enabled in the same location.
  4. Confirm that the remote shell is bash.
  5. Make sure that all startup scripts on the remote (.bashrc and .bash_profile, etc.) have default settings with respect to PROMPT_COMMAND, PS1 and TERM.
We have already covered steps 1, 2 and 4. Would you check step 3, and if that option is not enabled, you will need to move to step 5 and check all of your startup scripts for non-default settings. It might be easiest to rename your .bashrc and .bash_profile, etc. files and reconnect. If that resolves the issue, then you can determine what line in the files is causing the problem through the process of elimination.

If that doesn't help, then there is something else in your remote environment that is preventing the shell from functioning as one would expect.

Does this information help?

As a note, the Linux emulation is basically VT220 with a few modifications to aid in running Console applications. A Console application is one that would normally be run at the console, like setup.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730

Last edited by jdev; 09-16-2011 at 04:20 PM.
Reply With Quote
  #11  
Old 09-17-2011, 09:52 PM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Hi Todd,
I'm not using any PROMPT_COMMAND settings, just echo -ne and export PS1=

echo $PROMPT_COMMAND
from the command line comes back empty.

On the remote site when I remove my own .bashrc and include the system default explicitly (it doesn't get loaded otherwise) I do have a PROMPT_COMMAND

PROMPT_COMMAND='history -a ; echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'

but it still doesn't set the title. Do I need to have a PROMPT_COMMAND on the first system for this to work?

Cheers,
Chris
Reply With Quote
  #12  
Old 09-18-2011, 12:33 AM
MrC MrC is offline
Registered User
 
Join Date: Mar 2004
Posts: 216
Cbeck - you'll want to place your escape sequences all in the PS1 prompt, not in an echo line. This way, the prompt and screen title are changed at the same time, and will remain correct.

See a more complex example I posted some time ago that shows how to configure your prompt and titles. Post #6:

http://forums.vandyke.com/showthread.php?t=3639

The bulk of this setup was to make customizing your prompt easier and make the setup portable to other terminal environments.

The key to making the prompt work correctly (e.g. for command line editing) when it contains non-printable characters is to let bash (or tcsh) know about the portions of the prompt that are not printable. Otherwise, it incorrectly paints some lines during edit mode.

I'll be happy to answer questions you may have.
Reply With Quote
  #13  
Old 09-20-2011, 09:48 AM
cbeck cbeck is offline
Registered User
 
Join Date: Sep 2011
Posts: 7
Hi Todd, MrC

Yep, adding it to the PROMPT_COMMAND solved the problem.
Cheers!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:00 AM.