Calling a script with x3270 -script

1k Views Asked by At

I have an old script which is used to scrape information from an IBM server via x3270. However, I can't get it to work correctly. This is how I'm calling it:

/usr/X11R6/bin/x3270 -script -model 3279-2 -geom +110+160 -efont 3270-20 'Script( "/usr/X11R6/lib/X11/x3270/qmon_script.sh" )'

I get an x3270 window and the following error message: Hostname syntax error: Multiple port names

The script I'm calling handles all the connection details, but x3270 appears to be confused and is thinking 'Script( "/usr/X11R6/lib/X11/x3270/qmon_script.sh" )' is the hostname (which is obviously not correct).

I've been unable to find any good examples on how to call a script through x3270 like this. Any ideas?

1

There are 1 best solutions below

0
On

According to the documentation for x3270:

-script

Causes x3270 to read commands from standard input, with the results written to standard output. The protocol for these commands is documented in x3270-script(1).

So it doesn't allow giving the script itself on the command line. Instead you're supposed to supply the script through standard input. You probably want either:

echo 'Script( "/usr/X11R6/lib/X11/x3270/qmon_script.sh" )' | /usr/X11R6/bin/x3270 -script -model 3279-2 -geom +110+160 -efont 3270-20  

Or maybe:

/usr/X11R6/bin/x3270 -script -model 3279-2 -geom +110+160 -efont 3270-20 < /usr/X11R6/lib/X11/x3270/qmon_script.sh