A quick google search yields this treasure trove of geocache-related scripts: http://geo.rkkda.com/ I believe the geo-dist script is what you're looking for. They're general unix-compatible shell scripts - mostly (if not entirely) bash scripts.