BBS水木清华站∶精华区

发信人: jinll (little~lily), 信区: Unix 
 
   有特殊用途,现想不通过交互式命令输入ftp. 有否参数可以从文件中读user.passwd和 
目录? 
我记得以前好象用过的,现在在Solaris 2.6下,用man查了以下,没有可用的选项. 
   请各位高手帮忙. 
 
 
 
 
发信人: gaoling (gp), 信区: Unix 
 
can $(HOME)/.netrc satisfy u? 
 
 
【 在 jinll (little~lily) 的大作中提到: 】 
    有特殊用途,现想不通过交互式命令输入ftp. 有否参数可以从文件中读user.passwd和 
 目录? 
 我记得以前好象用过的,现在在Solaris 2.6下,用man查了以下,没有可用的选项. 
    请各位高手帮忙. 
 
 
 
 
发信人: Bgun (乖乖火箭炮), 信区: Unix 
 
 
用来干吗,定时执行还是???? 
 
【 在 jinll (little~lily) 的大作中提到: 】 
    有特殊用途,现想不通过交互式命令输入ftp. 有否参数可以从文件中读user.passwd和 
 目录? 
 我记得以前好象用过的,现在在Solaris 2.6下,用man查了以下,没有可用的选项. 
    请各位高手帮忙. 
 
 
 
 
发信人: emwang (快乐), 信区: Unix 
 
【 在 gaoling (gp) 的大作中提到: 】 
 can $(HOME)/.netrc satisfy u? 
为什么在$HOME下找不到.netrc 
 
 
发信人: wangmx (沧海一声叫), 信区: Unix 
 
【 在 emwang (快乐) 的大作中提到: 】 
 【 在 gaoling (gp) 的大作中提到: 】 
 为什么在$HOME下找不到.netrc 
 
赫赫,得自己建一个 
另属性必须是600,否则不灵  
 
 
发信人: serendipity (hello), 信区: Unix 
 
You must create such a file by yourself. 
 
 
【 在 emwang (快乐) 的大作中提到: 】 
 【 在 gaoling (gp) 的大作中提到: 】 
 为什么在$HOME下找不到.netrc 
 
 
 
 
发信人: xwood (小木), 信区: Unix 
 
【 在 emwang (快乐) 的大作中提到: 】 
 【 在 gaoling (gp) 的大作中提到: 】 
 为什么在$HOME下找不到.netrc 
 
Create one like this: 
 
echo "default login anonymous password guest@" > ~/.netrc 
chmod 600 ~/.netrc 
 
 
 
发信人: penda (凶猛), 信区: Unix 
 
【 在 xwood (小木) 的大作中提到: 】 
 Create one like this: 
 echo "default login anonymous password guest@" > ~/.netrc 
 chmod 600 ~/.netrc 
 
another sample..: 
 
machine xxx.xxx.xxx(where you are looking for) login ftp password guest@ 
machine xx1.111 login ftp password guest@ 
 
 
 
发信人: scaner (好好), 信区: Unix 
 
ftp -n <ftpcmd不就可以了 
ftpcmd里放ftp 命令 
open xxx.xxxx.xxx 
user yyyyy zzzzz 
cd /hhh/jjjj 
 
bin 
get ddd.ddd 
quit 
 
【 在 penda (凶猛) 的大作中提到: 】 
 another sample..: 
 machine xxx.xxx.xxx(where you are looking for) login ftp password guest@ 
 machine xx1.111 login ftp password guest@ 
 
 
 
 
发信人: numerical (compiler), 信区: Unix 
 
其实几乎所有类似的交互式问题都能用expect解决,比如ftp,passwd,telnet, 
gdb(testing debugger),后三者不能用shell scripts解决,而ftp能用一个 
script启动,但我想如果线路有问题,program只有退出,而不能re-connect. 
 
废话少说,言归正传. 
 
你的问题可以用一段code解决: 
 
#! /usr/bin/expect 
 
# you can pass your host name from command line 
spawn ftp ftp.name 
expect "Name" 
send "anonymous\r" 
expect "Password:" 
send "yourname@domain\r" 
expect "ftp>" 
interact 
 
如果你要error checking的化, define要个function 
把你的function放在while loop里面就可以. 
 
BTW: expect is tcl-based language. 
 
 
 
【 在 jinll (little~lily) 的大作中提到: 】 
    有特殊用途,现想不通过交互式命令输入ftp. 有否参数可以从文件中读user.passwd和 
 目录? 
 我记得以前好象用过的,现在在Solaris 2.6下,用man查了以下,没有可用的选项. 
    请各位高手帮忙. 
 
 
 
 

BBS水木清华站∶精华区