To exchange para­me­ters between Bash and Pro­cess­ing you can write the vari­able into a text file with echo

echo $GRIDTYPE > $TMP/gridsize.i

and later on you read the text file with Processing.

howmanyframes = int(loadStrings("tmp/gridsize.i")[0]);

That’s all Folks!