$ZDirectory

$ZD[IRECTORY] contains the string value of the full path of the current directory. Initially $ZDIRECTORY contains the default/current directory from which the GT.M image/process was activated.

If the current directory does not exist at the time of GT.M process activation, GT.M errors out.

Example:

GTM>WRITE $ZDIR
/usr/tmp
GTM>SET $ZDIR=".."
GTM>WRITE $ZDIR
/usr

This example displays the current working directory and changes $ZDIR to the parent directory.

$ZDIRECTORY is a read-write Intrinsic Special Variable, that is, it can appear on the left side of the equal sign (=) in the argument to a SET command. If an attempt is made to set $ZDIRECTORY to a non-existent directory specification, GT.M issues an error and keeps the value of $ZDIRECTORY unchanged.

At image exit, GT.M restores the current directory to the directory that was the current directory when GT.M was invoked even if that directory does not exist.