linux中判定远程目录是否存在
2014-02-08 09:30
253 查看
#!/usr/bin/expect -f
set username [lindex $argv 0]
set passwd [lindex $argv 1]
set destIP [lindex $argv 2]
set destDIR [lindex $argv 3]
set timeout 15
spawn ssh $username@$destIP
expect {
"(yes/no)?" { send "yes\n";exp_continue}
"*assword*" { send "$passwd\n";exp_continue }
"*assword*" { send "exit 1 \n" }
}
expect "#"
send "mkdir -p /tmp/testSendLog\n"
expect "#"
send "test -d $destDIR\n"
expect "#"
send "echo $? > /tmp/testSendLog/text.txt\n"
expect "#"
send "exit\r"
expect eof
set username [lindex $argv 0]
set passwd [lindex $argv 1]
set destIP [lindex $argv 2]
set destDIR [lindex $argv 3]
set timeout 15
spawn ssh $username@$destIP
expect {
"(yes/no)?" { send "yes\n";exp_continue}
"*assword*" { send "$passwd\n";exp_continue }
"*assword*" { send "exit 1 \n" }
}
expect "#"
send "mkdir -p /tmp/testSendLog\n"
expect "#"
send "test -d $destDIR\n"
expect "#"
send "echo $? > /tmp/testSendLog/text.txt\n"
expect "#"
send "exit\r"
expect eof
相关文章推荐
- centos6.4安装vim7.3
- centos6.4安装chrome浏览器
- Linux服务器性能评估与优化--转
- Linux的内存管理-2
- linux下制作Bootable-U盘
- CentOS 6 NTFS移动硬盘 使用实战
- 寒假学习 第18、19天 (linux 高级编程)
- linux 查看系统信息命令(比较全)
- Linux常用命令总结
- linux常用命令笔记
- REDHAT6.3YUM替换为CENTOSYUM
- linux 下ftp服务的搭建
- 十三个强大的Linux性能监测工具
- 深刻理解Linux进程间通信(IPC)
- linux系统命令
- 第一天 Linux 是什么
- Linux下安装openldap
- 人在江湖飘,哪能不挨刀。CENTOS之后,UBUNTU,FEDORA都要安装起来作测试啊
- StartOS可以自动加载windows的各个硬盘,很给力
- linux环境下C编程(一)