Need assistance with gnome-terminal and ssh

I am trying to create an alias on a linux tcsh that will open a gnome-terminal and then ssh into a server that is using bash shell then ssh into a second server that is using bash shel and on that server change the title of the window. Ive been asking chatGPT and its been somewhat helpful but I still cannot get the window title to change once i get to the second server. The command Im using is as follows:
gnome-terminal -- /usr/bin/ssh -t user1@server1 ; /usr/bin/ssh -t user2@server2 '\''echo -en "\033]0;TEST\007"
I can make it all the way into the second server but the title DOESNT ever change. Any ideas would be greatly helpful! -Brian-

When posting, please wrap your code in triple-backticks to protect it from reformatting!

Start with one terminal.
Try the following:

gnome-terminal -t "user1@server1" -- /usr/bin/ssh -t user1@server1

Does it work?
Do you want to run the second ssh as user1 on server1?

I'll be getting back from a trip tonight and will try then

Alright i just tried it, its doesnt work. It ssh's into the server but doesnt carry through the New Title

Just to be certain I understand what you are trying to do:
You are on WorkstationA,
You want a terminal window that will:
1- SSH to server1 as user1
2- SSH from server1 to server2 as user2
3- Show the window title as user2@server2
Is that correct?

In this example, you are running 2 commands.
Open a terminal window and have that window ssh into serve1 as user1 (First Process Created)
SSh to server2 as user2 (Second Process Created)

What you want to do is 1 command.
Open a terminal window and have that window ssh to server1 as user1 AND THEN ssh to server2 as user2

I am assuming that either:
user2 does not have login credentials on server1 -or-
your starting server (WorkstationA) is not allowed to log in to server2 (I'm not referring to a blocked path, I'm referring to hosts.all/hosts.deny)

Group your two SSH commands together in quotes so that gnome-terminal knows to take them together. That would look something like this:

gnome-terminal -- "/usr/bin/ssh -t user1@server1 ; /usr/bin/ssh -t user2@server2" '\''echo -en "\033]0;TEST\007"
(I believe there is a syntax error with the single vs double quotes, or it is a copy paste error)

I will be staying as User1 all the way through..

Your version of ssh may have a *-J* option for Jump. The ide is to login to server2 through server1.
[me@workstation ~] ssh -J user1@server1 user2@server2

If there were no intermediate host required, your ssh command would look like this:
[me@workstation ~] ssh user2@server2
The server2 would recognize the the user me on host workstation is trying to authenticate as user2.
If server2 is configured to NOT allow user me or host workstation login, the attempt will be rejected. If user2 is not defined on server2 the login attempt will be rejected.

To do this in 2 steps:
[me@workstation ~] ssh user1@server1
[user1@server1 ~] ssh user2@server2
[user2@server2 ~]
In this example, server2 will see the user user1 logging in from host server1 and trying to authenticate as user2.
This notice how this differs from the Jump option.
YMMV.

@bfpa401 please clarify if you want to ssh to server2 from server1 or from your workstation? It sounds like you want to ssh from your workstation to server1 and then from server1 to server2, but the syntax of your command makes me think that the (second) ssh to server2 is from your workstation.

I would think you would want to do something like the following:

/usr/bin/ssh -t user1@server1 "/usr/bin/ssh -t user2@server2 'echo -en \"\033]0;TEST\007\"'"

N.B. the escaping on this is going to be entertaining.

Are you able to change the title using your echo command when manually sshing into server2? -- Not all terminals recognize and / or allow changing terminal parameters like the title. XTerm has an option named "Allow Terminal Ops" to explicitly enable / disable this capability.

I've got the following proof of concept working in an interactive terminal.

ssh user1@server1 "ssh user2@server2 \"echo '\\033]0;TEST\\007'\""

Once you get the command itself working, then you can work on integrating it into a launcher. -- Sadly, I can't help much with launchers as I don't use them often.

I will say that the multiple levels of nesting make the escaping complicated. I'd suggest that you break this down into individual components as well as put it into a script rather than trying to do it on the command line. A script will be more resilient and avoid needing to account for various things (mis)interpreting the escaping.

According to
man gnome-terminal
you can directly set a window title with
gnome-terminal -t titlename
but this seems not to work for the o/p.