2

I'm using Centos 7. When I sshpass to my remote login server, I need to specify the title to every terminal I open through gnome-terminal. I tried following approach from the link suggested by @Jesse_b in the first comment.

gnome-terminal --maximize 
--tab -e 'bash -c "echo -ne \"\033]0;title1\007\"; top"' \ "sshpass -p "Password" ssh -o StrictHostKeyChecking=no mayank@IP_add 'cd /abcd/efg/ ; bash;'"

gnome-terminal --maximize 
--tab -e 'bash -c "echo -ne \"\033]0;title2\007\"; bash -i"' \ "sshpass -p "Password" ssh -o StrictHostKeyChecking=no mayank@IP_add 'cd /abcd/efg/ ; bash;'"

I've created following function in ~/.bashrc as it mentioned in that link.

function set-title() {
  if [[ -z "$ORIG" ]]; then
  ORIG=$PS1
fi
  TITLE="\[\e]2;$*\a\]"
  PS1=${ORIG}${TITLE}
}

In my first terminal title is getting changed but it seems I can't use it for further use. And my second terminal launched but did not login to my server neither changed the title. Image of first terminal is

Terminal-title1

But when I ran following command as I want to achieve more than two terminal.

gnome-terminal --maximize 
---tab -t "Title1" -e "sshpass -p "Password" ssh -o StrictHostKeyChecking=no mayank@Ip_add 'cd /abcd/efg/ ; bash;'" 

All the terminals are being opened, their titles are changing and loging in on my server but, again I cannot use them further.

Please suggest any solution, what am I doing wrong.

MayankD
  • 43
  • When in doubt about command parameters, man gnome-terminal. But it should still be a must read for all open source "developers": https://en.wikipedia.org/wiki/Backward_compatibility – ajeh Jun 22 '18 at 13:53
  • Thanks @Jesse_b for that link, it did help but I'm still facing some problems as I've edited and specified them in my question. – MayankD Jun 23 '18 at 11:30

0 Answers0