Yes, what I do is use a ksh script as normal (
#!/bin/ksh at the top) and when I want to use expect I put the expect code in a separate
scriptname.exp file (with
#!/usr/local/bin/expect -f at the top, changing the location to suit) and call
scriptname.exp from within the ksh script. So not quite using
ksh(1) and
expect(1) in the same script but I hope this is what you were trying to acheive?