[GRASS-SVN] r49664 - grass-addons/grass6/raster3d/r3.in.xyz

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 12 01:51:34 EST 2011


Author: hamish
Date: 2011-12-11 22:51:34 -0800 (Sun, 11 Dec 2011)
New Revision: 49664

Modified:
   grass-addons/grass6/raster3d/r3.in.xyz/r3.in.xyz
Log:
no seq on Macs, so we have to create one

Modified: grass-addons/grass6/raster3d/r3.in.xyz/r3.in.xyz
===================================================================
--- grass-addons/grass6/raster3d/r3.in.xyz/r3.in.xyz	2011-12-12 06:29:32 UTC (rev 49663)
+++ grass-addons/grass6/raster3d/r3.in.xyz/r3.in.xyz	2011-12-12 06:51:34 UTC (rev 49664)
@@ -187,7 +187,28 @@
 LC_NUMERIC=C
 export LC_NUMERIC
 
+#### check if we have seq  (Max OSX doesn't)
+# perhaps try `type -t` instead of `which`, as it is more POSIXy
+if [ -x "`which seq`" ] ; then
+   SEQ=seq
+else
+   SEQ=expr_seq
+fi
+expr_seq()
+{
+   if [ $# -ne 1 ] ; then
+      echo "shell seq: only 'seq \$n' implemented so far." 1>&2
+      return 1
+   fi
 
+   j=1
+   while [ "$j" -le "$1" ] ; do
+      echo "$j"
+      j=`expr $j + 1`
+   done
+}
+
+
 cleanup()
 {
     g.message -v "Cleaning up ..."
@@ -237,7 +258,7 @@
 # init
 EXIT_CODE=0
 
-for i in `seq "$depths"` ; do
+for i in `$SEQ "$depths"` ; do
 
     i_str=`echo $i | awk '{printf("%05d", $1)}'` 
 



More information about the grass-commit mailing list