1

So I am working with shell script on Ubuntu Linux and I'm trying to create a script that calculates the ndvi of 2 rasters using Grass GIS, but that is not the problem. The problem is that every time I am trying to execute a command I get an error like this line 52: g.list: command not found and I have used this link (https://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu) to install Grass, is there a way to fix it?

  • 1
    Are you running the script in a GRASS session ?? – Micha May 27 '17 at 8:16
  • No, maybe I forgot to start GRASS from a command. Is there a special Shell command, or is it just start Grass ? – George Nostradamos May 28 '17 at 5:59
  • Yes, type "grass72" into a terminal window – markusN May 28 '17 at 20:01
  • I did with grass70 and it launches, as it should, but I can't seem to execute my shell, maybe I haven't used my directories correctly – George Nostradamos May 29 '17 at 10:52
0

So the trick here was to set the paths right and because I wanted my script to work on multiple machines I added the followed lines:

echo -n "Enter Grass program directory (i.e /usr/lib/grass70):"
read GRASS_P
export GISBASE=$GRASS_P

echo -n "Enter the number of your GRASS version (i.e 70):"
read version
export GRASS_VERSION=$version

and I did this for every directory.

And so I placed my inputs in strings and then I set my paths based on those inputs.

If what I did was wrong feel free to correct me, but it worked for my situation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.