zsh-users
 help / color / mirror / code / Atom feed
* suing zpty how to switch to interactive mode?
@ 2009-12-19 22:39 Marc Weber
  2009-12-19 23:00 ` Marc Weber
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Weber @ 2009-12-19 22:39 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: suing zpty how to switch to interactive mode?
  2009-12-19 22:39 suing zpty how to switch to interactive mode? Marc Weber
@ 2009-12-19 23:00 ` Marc Weber
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Weber @ 2009-12-19 23:00 UTC (permalink / raw)
  To: zsh-users

Mikachu (on irc) told me about

ssh user@host -t "cd /tmp; exec \$SHELL" which works for me.

However if you the .zshrc isn't sourced automatically before running
exec.

So I'm still interested in getting to know whether there is a simple
solution (without using expect)

Marc Weber


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-19 23:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-19 22:39 suing zpty how to switch to interactive mode? Marc Weber
2009-12-19 23:00 ` Marc Weber

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).