writing a script to auto-upload

I want to be able to write a script that will upload a sketch to an arduino board without the user being able to read the contents of the source code.

Can anyone point me in the right direction?

Thanks!

depends on how far you want to go on the (lets call it) server.
If you dont want to compile there, but on the computer that is remotely connected you could 'simply' send the hex file and upload it via avrdude from there...