Sorry by last reply about this was wrong; leave out the evals. THe lines DB_DATABASE=`cat ~/.grassrc5 | grep DB_DATABASE| cut -d' ' -f2` DB_DATABASE=`cat ~/.grassrc5 | grep PG_DBASE| cut -d' ' -f2` should actually be changed to DB_DATABASE=`g.gisenv get=DB_DATABASE` DB_DATABASE=`g.gisenv get=PG_DBASE`