Created
February 18, 2012 06:18
-
-
Save klange/1857800 to your computer and use it in GitHub Desktop.
Improved Parallel Echo for Screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" == "" ]; then | |
echo 'Usage: pecho [window_number [window_number [...]]]' | |
return 1 | |
fi | |
echo -e "\e[1m[echoing in parallel on screens $@]\e[0m" | |
stty -echo | |
while IFS= read -r -s -n1 c; do | |
for screen in $@; do | |
if [ "$c" == "" ]; then | |
screen -X -p $screen stuff $'\012' | |
else | |
screen -X -p $screen stuff $"$c" | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment