[GRASS5] r.in.srtm zip check

Markus Neteler neteler at itc.it
Mon Mar 20 05:30:37 EST 2006


On Mon, Mar 20, 2006 at 01:25:52PM +1200, Hamish wrote:
> r.in.srtm has this check:
> 
> if test ! -f $FILE.hgt.zip ; then
>  echo "File '$FILE.hgt.zip' not found"
>  exit 1
> fi
> 
> ls -1 "$FILE.hgt.zip" | grep zip > /dev/null
> if [ $? -ne 0 ] ; then
>   echo "$FILE.hgt.zip is no zip file."
>   exit 1
> fi
> 
> 
> is the second one meant to be a check to see that file is a valid ZIP
> file? 

Yes (if I recall correctly)

> If so, better to check against `file $FILE.hgt.zip` ?

Maybe:

file -ib N46E011.hgt.zip
application/x-zip

Fixed like this in CVS.
 
> also it should check that `unzip` exists, ala awk. On Debian at least I
> don't think it is installed by default. Currently exits cleanly if not
> there.

test added.

thanks

 Markus




More information about the grass-dev mailing list