Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
suing zpty how to switch to interactive mode?
- X-seq: zsh-users 14668
- From: Marc Weber <marco-oweber@xxxxxx>
- To: zsh-users@xxxxxxx
- Subject: suing zpty how to switch to interactive mode?
- Date: Sat, 19 Dec 2009 23:39:07 +0100
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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