This initially led me to develop multiple shell and expect scripts that called eachother passing arguments between eachother that was received from a 'master' script. This is very ugly though codewise and also that you could see entered passwords via 'ps' because I was passing it as an argument to other scripts.
To get around my issues I needed to:
- Use 1 script
- Have script start s3270 and be able to pass commands to it (not have s3270 call a script)
- have expect functionality
mkfifo /tmp/3270.in /tmp/3270.outI also backgorunded the s3270 process because otherwise you are stuck in s3270 to enter commands for it.
s3270 /tmp/3270.out &
I then created filedescripors that copied my FIFOs:
exec 5>/tmp/3270.in 6Now I set 2 enviornment variables that x3270if uses to know what filedescriptors to use when communicating with an s3270 process:
rm -f /tmp/3270.in /tmp/3270.out
X3270INPUT=5That's it for goal #1! I can now do commands such as the following:
X3270OUTPUT=6
export X3270INPUT X3270OUTPUT
x3270if "connect(192.168.1.100)"Which would instruct my s3270 terminal to connect to a frame on IP 192.168.1.100.
With this functionality alone I can then use expect scripting alone to do everything I want which meets my other goals. However, I don't like Tcl expect so I chose to use python scripting using pexpect for expect functionality to script everything.
I found the redirect solution I detailed above after scouring google and finding the following link to a script that someone else made @ http://www.sfr-fresh.com/unix/misc/x3270-3.3.9ga12.tgz:a/x3270-3.3/Examples/cms_logon.sh