cd /tmp/$1 cp code.code interim.java name=$(cat interim.java | grep -Eo 'public\s+class\s+([A-Za-z0-9]+)' | sed -n 's/ */ /gp' | cut -d' ' -f3) mv interim.java $name.java timeout -s KILL 10 javac $name.java timeout -s KILL 3 bash -c "cat args.args | xargs -d '\n' java $name"