I learnt how to use GRASS GIS from an Ubuntu machine, directly using the command line. I wrote my commands in a text editor (e.g., Notepad++), and I just copied and pasted the lines I was interested into (without using the GUI or loading a script) like this:
g.region -p raster=EU_3035 res=1000
while read sp;
do
echo "LOAD $sp"
r.in.gdal --o input='/data/lisa/GRASS/'$sp'.tif' output=$sp
done < /data/lisa/GRASS/species.txt
Now I had to switch to use GRASS GIS on my Windows 10 machine. If I try to paste something like that (various lines with different commands), g.region
and while read
are interpreted as a single command, even if I separate them with a ;
. Of course I can run each command separatedly, first
g.region -p raster=EU_3035 res=1000
and then
while read sp;
do
echo "LOAD $sp"
r.in.gdal --o input='C:\Users\Lisa\Desktop\PhD\GRASS\'$sp'.tif' output=$sp
done < C:\Users\Lisa\Desktop\PhD\GRASS\species.txt
but I want to run everything together, and in any case, I get this error:
'while' is not recognized as an internal or external command, operable program or batch file.
I can understand the same language cannot be used between Linux and Windows. Unfortunately, I don't know any Python. Is there a way to copy-paste my commands as I used to, or is there a way to write them all in a script and load it?
I already tried to save my commands (g.region
and while read
, in this case) into a script (script1.sh
) that starts with #!/bin/bash
, and then I tried to write both into the command line and into the GUI console sh C:\Users\Lisa\Desktop\PhD\GRASS\script1.sh
, but again I get the same error as before. Here Return variable with GRASS GIS on a Windows machine a "unix like shell" is mentioned. Is that something that can allow me to use GRASS as if I was in a Linux environment, even if I'm on Windows?
I am very inexperienced as you can see, so forgive any inaccuracy.
My GRASS GIS version is 7.8.7