Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

suing zpty how to switch to interactive mode?



I already know pexpect or expect. However I wonder whether I can so some
simple tasks using zsh as well?

I have in mind logging in using ssh and changing directory, then switch
to interactive mode.

Eg this works:
{ echo "cd /tmp"; cat  } |  ssh user@host

However I can't get a terminal:

 scripts i%{ echo "cd /tmp"; cat  } |  ssh -t  user@host
Pseudo-terminal will not be allocated because stdin is not a terminal.


Can this be done using zpty ?

I got close:

zpty -b test /bin/sh
zpty -w test "cd /tmp"
# connect stdout
{ while :; do zpty -r test; done; }&
# connect stdin
zpty -w test

Then you can type pwd and you'll get /tmp as reply.

However basic stuff such as tab completion is not working..

What happens to stderr?

Probably I should stick with expect..

Marc Weber



Messages sorted by: Reverse Date, Date, Thread, Author