Port tests/expect.sh, foreign.test.sh to FreeBSD's shell