免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
论坛 程序设计 Shell 请教
最近访问板块 发新帖
打印 上一主题 下一主题

请教 [复制链接]

论坛徽章:
3
天秤座
日期:2013-12-27 13:44:58射手座
日期:2014-05-22 16:52:43天蝎座
日期:2014-08-13 16:03:21
21 [报告]
发表于 2011-01-21 14:32 |只看该作者
NAME
       ptmx and pts - pseudo-terminal master and slave

DESCRIPTION
       The file /dev/ptmx is a character file with major number 5 and minor number 2, usually of mode
       0666 and owner.group of root.root.  It is used to create a pseudo-terminal  master  and  slave
       pair.

       When  a process opens /dev/ptmx, it gets a file descriptor for a pseudo-terminal master (PTM),
       and a pseudo-terminal slave (PTS) device is created in  the  /dev/pts  directory.   Each  file
       descriptor  obtained  by  opening /dev/ptmx is an independent PTM with its own associated PTS,
       whose path can be found by passing the descriptor to ptsname(3).

       Before opening the pseudo-terminal slave, you  must  pass  the  master's  file  descriptor  to
       grantpt(3) and unlockpt(3).

       Once  both the pseudo-terminal master and slave are open, the slave provides processes with an
       interface that is identical to that of a real terminal.

       Data written to the slave is presented on the master descriptor as input.  Data written to the
       master is presented to the slave as input.

       In  practice,  pseudo-terminals are used for implementing terminal emulators such as xterm(1),
       in which data read from the pseudo-terminal master is interpreted by the  application  in  the
       same  way a real terminal would interpret the data, and for implementing remote-login programs
       such as sshd(, in which data read from the pseudo-terminal master is sent across the network
       to a client program that is connected to a terminal or terminal emulator.

       Pseudo-terminals can also be used to send input to programs that normally refuse to read input
       from pipes (such as su(1), and passwd(1)).

论坛徽章:
0
22 [报告]
发表于 2011-01-21 15:04 |只看该作者
人家说啥你都否定 你自己想吧  还挺难伺候

论坛徽章:
1
巨蟹座
日期:2014-06-04 13:33:30
23 [报告]
发表于 2011-01-21 17:03 |只看该作者
回复 10# 拿钱发帖死全家


    这有什么好麻烦的。。。就2行
  1. #!/usr/bin/expect -f
  2. eval spawn scp filename HostName_or_IP:.
  3. expect "*password:"
  4. send "Your_passwd\n"
  5. expect "$"
复制代码

论坛徽章:
0
24 [报告]
发表于 2011-01-21 17:07 |只看该作者
回复  拿钱发帖死全家


    这有什么好麻烦的。。。就2行
xiaobaibbb 发表于 2011-01-21 17:03



    代码不麻烦,关键是系统现在没有expect命令,还得装,在线系统,客户可不让随便装东西

论坛徽章:
0
25 [报告]
发表于 2011-01-21 17:09 |只看该作者
人家说啥你都否定 你自己想吧  还挺难伺候
爱斯基摩寂寞 发表于 2011-01-21 15:04



    我是想要我说的那种方法,而不是否定别人的方法,但他们的方法都不是我要的方法啊

论坛徽章:
1
巨蟹座
日期:2014-06-04 13:33:30
26 [报告]
发表于 2011-01-21 17:13 |只看该作者
回复 24# 拿钱发帖死全家


    什么系统? 而且在线系统装个expect跟他也不会有任何影响吧?

论坛徽章:
0
27 [报告]
发表于 2011-01-21 17:15 |只看该作者
回复  拿钱发帖死全家


    什么系统? 而且在线系统装个expect跟他也不会有任何影响吧?
xiaobaibbb 发表于 2011-01-21 17:13



    对,基本没影响,但客户那边不好交代啊;
solaris,系统默认没有expect

论坛徽章:
3
2015年迎新春徽章
日期:2015-03-04 09:56:11数据库技术版块每日发帖之星
日期:2016-08-03 06:20:00数据库技术版块每日发帖之星
日期:2016-08-04 06:20:00
28 [报告]
发表于 2011-01-21 21:50 |只看该作者
我是想要我说的那种方法,而不是否定别人的方法,但他们的方法都不是我要的方法啊
拿钱发帖死全家 发表于 2011-01-21 17:09



    对于那种标准输入判断必须是终端的程序来说,你只能用这个特殊的字符设备骗过程序,别无他法了

论坛徽章:
3
2015年迎新春徽章
日期:2015-03-04 09:56:11数据库技术版块每日发帖之星
日期:2016-08-03 06:20:00数据库技术版块每日发帖之星
日期:2016-08-04 06:20:00
29 [报告]
发表于 2011-01-21 21:51 |只看该作者
对于那种标准输入判断必须是终端的程序来说,你只能用这个特殊的字符设备骗过程序,别无他法了
cjaizss 发表于 2011-01-21 21:50



    我就没明白怎么不是你需要的办法呢?

论坛徽章:
0
30 [报告]
发表于 2011-01-21 22:04 |只看该作者
我就没明白怎么不是你需要的办法呢?
cjaizss 发表于 2011-01-21 21:51



    我记得之前有个办法是通过某个方法往后面的命令输入内容的,就像管道符一样,只不过我忘了怎么用了,这就是我现在想用的方法。
expect我也会用,只是不是我现在想用的方法,如此而已
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP