first version of ghist2db.sh