From a7280e2069264b7ed574b98ba46e6cf19d7114cc Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 23 Jan 2017 11:14:40 +0000 Subject: [PATCH] Examples: Python Index --- examples/python/grib_index.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/examples/python/grib_index.sh b/examples/python/grib_index.sh index 110dde63f..962d7e62a 100755 --- a/examples/python/grib_index.sh +++ b/examples/python/grib_index.sh @@ -2,5 +2,21 @@ . ./include.sh -$PYTHON $examples_src/grib_index.py -rm -f my.idx +TEMP1=temp1.grib_index.py.txt +TEMP2=temp2.grib_index.py.txt + +IDX_FILE=my.idx +rm -f $IDX_FILE + +# First time it will create the index file +$PYTHON $examples_src/grib_index.py > $TEMP1 + +[ -f "$IDX_FILE" ] + +# Second time it will use the file created before +$PYTHON $examples_src/grib_index.py > $TEMP2 + +# Check output in both cases is the same +diff $TEMP1 $TEMP2 + +rm -f $IDX_FILE $TEMP1 $TEMP2