[GRASS5] $LOCATION or not $LOCATION ?

Eric G. Miller egm2 at jps.net
Thu May 16 06:26:50 EDT 2002


On Thu, May 16, 2002 at 09:51:14AM +0100, Glynn Clements wrote:

> Like Bourne shell, Perl has backticks. But, unlike Bourne shell,
> Perl's backticks don't strip the newline from the output. So, using:
> 
> 	$gisdbase=`g.gisenv get=GISDBASE`
> 
> includes the trailing newline. If you can figure out how to remove it,
> that may be simpler than the loop.

Errmm...

$ENV{GISDBASE} = `g.gisenv get=GISDBASE`;
chomp $ENV{GISDBASE};
$ENV{LOCATION_NAME} = `g.gisenv get=LOCATION_NAME`;
chomp $ENV{LOCATION_NAME};
$ENV{MAPSET} = `g.gisenv get=MAPSET`;
chomp $ENV{MAPSET};
$ENV{LOCATION} = "$ENV{GISDBASE}/$ENV{LOCATION_NAME}/$ENV{MAPSET}";

-- 
Eric G. Miller <egm2 at jps.net>



More information about the grass-dev mailing list