X3270OUTPUT environment variable

From The x3270 Wiki

The X3270OUTPUT environment variable is passed from the emulator to a program run by the Script() action. It indicates the file descriptor of a pipe used to send the result of actions executed by the emulator back to the script. The s3270 protocol defines the format of the data sent on this pipe and the input pipe indicated by X3270INPUT.

These two variables are used only on POSIX-based systems.


Questionable bash example, for a one-line result.

echo >&$X3270INPUT "Query(LocalEncoding)"
read -u$X3270OUTPUT result
read -u$X3270OUTPUT prompt
read -u$X3270OUTPUT ok
if [[ "$ok" = "ok" ]]
then success=1
else success=0