This is a follow up to a previous question on the creation of GRASS locations from a bash script.
Having successfully created a location, I would now like to create a new mapset within this location. The script looks like this:
#!/bin/sh # GRASS session variables GRASSDB="/tmp/grassdata" GRASSLOC="4326" # This is the EPSG code of the CRS used GRASSMAP="comparison" # path to GRASS binaries and libraries: export GISBASE=/usr/lib/grass74 export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GISBASE/lib # Create GRASS database folder mkdir -p "$GRASSDB" # Create a new GRASS location echo "==== Creating new GRASS location ====" grass74 -c -e "epsg:$GRASSLOC" "$GRASSDB/$GRASSLOC" echo "==== Creating new mapset ====" grass74 -c -e "$GRASSDB/$GRASSLOC/$comparison"
It produces the following output:
$ sh comparison.sh ==== Creating new GRASS location ==== Cleaning up temporary files... Creating new GRASS GIS location/mapset... Cleaning up temporary files... ==== Creating new mapset ==== Cleaning up temporary files... Creating new GRASS GIS location/mapset... ERROR: Failed to create new location. The location <4326> already exists. Exiting...
Unlike what is described in the wiki, the
-c argument always attempts to create a new location, and not just a mapset. How can I create just a mapset within an existing location?