Skip to content

Instantly share code, notes, and snippets.

@ushu
Created October 16, 2014 16:01
Show Gist options
  • Save ushu/4d8e164661cea8bd946f to your computer and use it in GitHub Desktop.
Save ushu/4d8e164661cea8bd946f to your computer and use it in GitHub Desktop.
Run a given program against an input
#!/bin/bash
cd /code
if [ -e code.c ]; then
gcc -o runner code.c || exit 1
cat input | runner
elif [ -e code.cpp ]; then
cat input | runner
elif [ -e code.rb ]; then
cat input | ruby code.rb
elif [ -e code.py ]; then
cat input | python code.py
else
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment