- [Show pagesource]
- [Old revisions]
- [Move]
zpty is a module that allow to create a virtual tty which can be written and read from the script. allowing to deal with command that refuses to get entry from a pipe : smbpasswd, ssh, scp.
to load
zmodload zsh/zpty
Here is an example of code using scp to automatically copy things over the network without asking password and without sharing keys
zpty scppty scp fichier user@IP:~/
zpty -t scppty || echo "fuck" && exit
zpty -r scppty line "*:" || echo "no password asked" && exit
zpty -w scppty "passwd"
while zpty -r scppty line;
do
result+="$line"$'\n'
done
zpty -d scppty
print $result
builtin/modules/zpty.txt · Last modified: 2008/04/03 17:07 by bapt


