dzek's bash script. awful