p.cmd 902 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #%module
  3. #% description: Wrapper for display commands and pX monitors
  4. #% keywords: display
  5. #%end
  6. #%option
  7. #% key: cmd
  8. #% type: string
  9. #% required: yes
  10. #% multiple: no
  11. #% label: Command to be performed
  12. #% description: Example: "d.rast map=elevation.dem@PERMANENT catlist=1300-1400 -i"
  13. #%end
  14. #%option
  15. #% key: opacity
  16. #% type: string
  17. #% required: no
  18. #% multiple: no
  19. #% key_desc: val
  20. #% description: Opacity level in percentage
  21. #% answer: 100
  22. #%end
  23. if [ -z "$GISBASE" ] ; then
  24. echo "You must be in GRASS GIS to run this program." 1>&2
  25. exit 1
  26. fi
  27. if [ "$1" != "@ARGS_PARSED@" ] ; then
  28. exec g.parser "$0" "$@"
  29. fi
  30. cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
  31. if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
  32. :
  33. else
  34. g.message -e "GRASS_PYCMDFILE File not found. Run p.mon"
  35. exit 1
  36. fi
  37. cmd="${GIS_OPT_CMD}"
  38. g.message -d message="$0: ${cmd}"
  39. echo ${cmd} >> ${cmdfile}
  40. exit 0