Created
November 3, 2012 08:31
-
-
Save avoidedlife/4006586 to your computer and use it in GitHub Desktop.
Bash Script to pipe the output of fortune(6) to a minecraft server running in a screen session
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 | |
IFS=$'\r' | |
fortune_lines=($(fortune | sed -e 's/^/say /' | fold -w 90 )) | |
Screen_Session=`screen -ls|grep "\."|grep "("|awk '{print $1}'` | |
Screen_OneLiner=$(screen -p 0 -S ${Screen_Session} -X stuff "`printf "${fortune_lines[@]}\r"`") | |
for var in "${Screen_OneLiner[@]}" | |
do | |
echo "${var}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment