You can use the built-in gfsh shell variables in scripts.

You can also use the set variable command to modify shell behavior or to define your own variables.

To see a list of all gfsh shell variables and their current values, use the following command:

gfsh>echo --string=$*

To obtain the current value of an existing variable, use the following command syntax (the variable must be enclosed in braces):

gfsh>echo --string=${VARIABLE}

For example:

gfsh>echo --string=${SYS_CLASSPATH}

System Variables

SYS_CLASSPATH CLASSPATH of the gfsh JVM (read only).
SYS_GEMFIRE_DIR Product directory where Tanzu GemFire has been installed (read only).
SYS_HOST_NAME Host from which gfsh is started (read only).
SYS_JAVA_VERSION Java version used (read only).
SYS_OS OS name (read only).
SYS_OS_LINE_SEPARATOR Line separator (\ or ^) variable that you can use when writing gfsh scripts. (read only).
SYS_USER User name (read only).
SYS_USER_HOME User’s home directory (read only).

GFSH Environment Variables

APP_FETCH_SIZE Fetch size to be used while querying. Values: 0 - 2147483647. Default value is 100.
APP_LAST_EXIT_STATUS Last command exit status. Similar to $? (Unix) and %errorlevel% (Windows). Values: 0 (successful), 1 (error), 2 (installation failure).
APP_LOGGING_ENABLED Whether gfsh logging is enabled. Default: false (read only). You can enable gfsh logging by setting the gfsh.log-level Java system property to a supported Java log level.
APP_LOG_FILE Path and name of current gfsh log file (read only).
APP_NAME Name of the application– “gfsh” (read only).
APP_PWD Current working directory where gfsh was launched (read only).
APP_QUERY_RESULTS_DISPLAY_MODE Toggle the display mode for returning query results. Values: table or catalog. Default value is table.
APP_QUIET_EXECUTION Whether the execution should be in quiet mode. Values (case insensitive): true, false. Default value is false.
APP_RESULT_VIEWER Unix only. Set this variable to external to enable viewing of the output using the UNIX less command. Default value is basic (gfsh).
check-circle-line exclamation-circle-line close-line
Scroll to top icon