I use a script which after execution opens different tabs and connects to different servers(using ssh). Now along with that,I want to run another command (say 'pwd').So how to do that?
gnome-terminal --tab -e 'ssh user@ip1' --tab -e 'ssh user@ip2'
This opens 2 tabs and connects to corresponding ip.After ssh in every tab I want to run another command, so that there will be two tabs,and after connecting to ip it will run specified command
You need to use SSH ability to execute remote command, like this:
gnome-terminal --tab -e "ssh -A -t user@ipbridge \"ssh -t user@ip1 'pwd; /bin/bash -i'\""
Note the /bin/bash -i after the command. It is needed, because otherwise ssh will exit after the command.