#3418 closed defect (worksforme)
"Launch Script (*.sh)" doesn't work on Windows
Reported by: | kking009 | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.2.3 |
Component: | Default | Version: | 7.2.2 |
Keywords: | shell script windows | Cc: | |
CPU: | Unspecified | Platform: | MSWindows 7 |
Description
Grass dispatches the *.sh file to windows, but obviously windows is not able to handle the bash script. Applies to all V7.X Versions. On V6.X that was working!
Change History (9)
comment:1 by , 7 years ago
follow-ups: 3 4 comment:2 by , 7 years ago
On V6.X Grass-Shell-Script were working Cross-Platform! I suppose Grass were handling them and they weren't dispatched to the OS. If I copy/execute line by line my script to the Grass-Comamnd-Console, Grass is able to "handle" my scripts.
follow-up: 5 comment:3 by , 7 years ago
Replying to kking009:
On V6.X Grass-Shell-Script were working Cross-Platform! I suppose Grass were handling them and they weren't dispatched to the OS. If I copy/execute line by line my script to the Grass-Comamnd-Console, Grass is able to "handle" my scripts.
I mean it more generally,shell scripts aren't working on all operating systems out of the box, unless you bundle extra bins with the software (e.g. msys in winGRASS).
IIRC There is a GRASS_SHELL variable to set (have a look in manual and wiki), but it's not really maintained anymore to have shell script support in winGRASS 7, as python is all around on the most is.
follow-up: 6 comment:4 by , 7 years ago
Replying to kking009:
On V6.X Grass-Shell-Script were working Cross-Platform! I suppose Grass were handling them and they weren't dispatched to the OS. If I copy/execute line by line my script to the Grass-Comamnd-Console, Grass is able to "handle" my scripts.
If you want simpy to execute some GRASS modules in a script, just put the module commands in a batch file in the following structure (I've added some notes in the wiki): e.g. myworkflow.bat
Rem set region to a raster
call g.region raster=yourraster
Rem calculate slope
call r.slope.aspect raste=yourraster slope=yourslope
Etc
comment:5 by , 7 years ago
Replying to hellik:
Replying to kking009:
On V6.X Grass-Shell-Script were working Cross-Platform! I suppose Grass were handling them and they weren't dispatched to the OS. If I copy/execute line by line my script to the Grass-Comamnd-Console, Grass is able to "handle" my scripts.
I mean it more generally,shell scripts aren't working on all operating systems out of the box, unless you bundle extra bins with the software (e.g. msys in winGRASS).
IIRC There is a GRASS_SHELL variable to set (have a look in manual and wiki), but it's not really maintained anymore to have shell script support in winGRASS 7, as python is all around on the most is.
in the manual:
GRASS_SH [shell scripts on Windows] path to bourne shell interpreter used to run shell scripts.
this variable can be set in the winGRASS startup batch file by e.g.
set GRASS_SH="C:\OSGeo4W64\apps\msys\bin\sh.exe"
comment:6 by , 7 years ago
Replying to hellik:
Replying to kking009:
On V6.X Grass-Shell-Script were working Cross-Platform! I suppose Grass were handling them and they weren't dispatched to the OS. If I copy/execute line by line my script to the Grass-Comamnd-Console, Grass is able to "handle" my scripts.
If you want simpy to execute some GRASS modules in a script, just put the module commands in a batch file in the following structure (I've added some notes in the wiki): e.g. myworkflow.bat
Rem set region to a raster
call g.region raster=yourraster
Rem calculate slope
call r.slope.aspect raste=yourraster slope=yourslope
Etc
for the record the wiki link:
https://grasswiki.osgeo.org/wiki/GRASS_and_bat-files_in_windows_console
follow-up: 9 comment:7 by , 7 years ago
I wasn't aware I can execute batch files from the "Grass Startup Console". They work perfectly! With the following command it is even possible to run batch files without starting up Grass:
"%ProgramFiles%\QGIS 2.18\bin\Grass72.bat" --exec MyScript.bat D:/myGrassData/MyLoc/MyMapset
Nice! For me its fine to close the issue..
comment:8 by , 7 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:9 by , 7 years ago
Replying to kking009:
I wasn't aware I can execute batch files from the "Grass Startup Console". They work perfectly! With the following command it is even possible to run batch files without starting up Grass:
"%ProgramFiles%\QGIS 2.18\bin\Grass72.bat" --exec MyScript.bat D:/myGrassData/MyLoc/MyMapset
Nice! For me its fine to close the issue..
I've expanded the wiki with your example:
https://grasswiki.osgeo.org/wiki/GRASS_and_bat-files_in_windows_console
please improve the wiki entry with your experience. thanks.
Replying to kking009:
I may note that it may be a won't fix.shell scripts aren't cross platform compatible.