Skip to content

Instantly share code, notes, and snippets.

@klange
Created February 18, 2012 06:18
Show Gist options
  • Save klange/1857800 to your computer and use it in GitHub Desktop.
Save klange/1857800 to your computer and use it in GitHub Desktop.
Improved Parallel Echo for Screen
#!/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