Converted database script-thing into super awesome Unix shell script