[GRASS-dev] Re: [GRASS GIS] #81: scripts: "echo -n" not portable

GRASS GIS trac at osgeo.org
Sat Mar 15 00:01:15 EDT 2008

#81: scripts: "echo -n" not portable
  Reporter:  hamish   |       Owner:  hamish   
      Type:  defect   |      Status:  assigned 
  Priority:  blocker  |   Milestone:  6.3.0    
 Component:  default  |     Version:  svn-trunk
Resolution:           |    Keywords:           
Comment (by hamish):

 Glynn wrote:
 > I wouldn't count on it; the shell may attempt to evaluate the ${...}
 > part.
 > I suspect that may be why it was output in pieces in the first place.
 > Try:
 >       echo 'eval '"$3"'=${'"$1""[$2]}"

 I glazed over last time I tried to follow that, not realizing that it is
 just a straight concatenation of the series of 'echo -n' lines. So no less
 safe than what is currently there.

 Paul also suggested using GRASS's own $GISBASE/etc/echo which respects -n,
 which could be clearer but doesn't help us ween ourselves off of
 workaround apps.

 I am currently leaning towards Glynn's suggestion as it requires a smaller

 I had guessed that in OSX 10.5 /bin/echo did not like -n but the bash
 shell was ok with it (and so !/bin/bash'ing r.tileset apparently worked
 without modification). Rereading William's comment in this bug report
 suggests the opposite it true. Best to just get rid of the -n rather than
 spend time trying to work out why..


Ticket URL: <http://trac.osgeo.org/grass/ticket/81#comment:4>
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

More information about the grass-dev mailing list