#!/bin/bash if [[ $# < 1 ]];then exit fi data="$@" for sess in $(tmux list-sessions | cut -d ":" -f 1);do tmux set-buffer "$data" for window in $(tmux list-windows -t $sess | tr -d ' ');do if grep -q -E "(zsh|bash)" <<< $window;then tmux paste-buffer -t $sess:${window%:*} tmux send-keys -t $sess:${window%:*} "Enter" fi done done # vim: set ft=sh