Inject things into a screen session

Say you have a screen session running and you want to have a bash script access and run a command, you can do it with this.

#!/bin/sh
screen -S minecraft -p 0 -X stuff "`printf "say This is a test.\r"`";

This injects the command “say This is a test” to the screen called minecraft. Found it on the minecraft forum. Pete