[GRASS-dev] [bug #5499] (grass) bash scripts starting with #!/bin/sh

Glynn Clements glynn at gclements.plus.com
Sun Mar 18 09:25:06 EDT 2007


Maciek Sieczka via RT wrote:

> Also, I guess (and only guess) that -+ and += would fail for non-Bash. There
> are some in r.tileset:
> 
> r.tileset:      for ((min_i=0;min_i<min_n;min_i+=1)) ; do

The "for ((...))" syntax is a bash-ism. If you want portability, you
have to use e.g.:

	min_i=0
	while $min_i -lt min_n ; do
		...
		min_i=`expr $min_i + 1`
	done

> Should min_i+=1 be replaced with `expr $min_i + 1` etc.?

Hamish decided that r.tileset was too bash-specific to fix, and just
put #!/bin/bash at the top.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list