Script to command multiple ssh windows.

Connection sharing, Firewall, Samba..etc
Forum rules
Before you post please read how to get help
Post Reply
Level 1
Level 1
Posts: 47
Joined: Mon Sep 23, 2013 7:39 am

Script to command multiple ssh windows.

Post by LarryTheLamb » Tue Jun 26, 2018 10:39 am

I have written a simple .sh script which opens a new window for each of a list of machines I want to SSH into. It works fine as does my shutdown script. I cannot find a way to enter each already open terminal windows and issue a command from a script. I know wmctrl -r can change focus to the required window and it works fine to that point but how do I then send a command to that window? If it was a tty session it would not be an issue but because of the way I've opened them or the way ssh works or whatever, the terminal windows all have the tty address of /dev/pts/0 so it isn't that simple. I've been googling all day and cannot find anything simple. I don't want to use Screen or any other terminal multiplexer apps. I just want a simple script way of doing it.
Any ideas?

User avatar
Level 5
Level 5
Posts: 911
Joined: Mon Nov 12, 2012 7:38 pm
Location: Indiana, USA

Re: Script to command multiple ssh windows.

Post by coffee412 » Tue Jun 26, 2018 6:19 pm

Hey Larry :)

Might this be a better answer to your question?

Here is a link that might help you out: ... a-ssh.html
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
IceWarp 12.0.3 * Mint 18.3 * RAID 1/5 * OpenVPN * Linux since kernel 2.0.36
************* Get Your Linux on! ***************

Post Reply

Return to “Other networking topics”