linux expect实现自动登录脚本

更新日期:2021-10-15

来源:纯净之家


系统大全为您提供
 1)安装expect
  [root@server ~]# yum install -y expect
  2)编写脚本
  #!/usr/bin/expect -f
  #created by mis_yw 2013-11-30
  #verify virus by system user oa
  #set password [1index $argv 0 ]
  #set timeout 10.
  set file [ lindex $argv 0 ]
  spawn su -c "/opt

spersky

v4fs/bin

v4fs-control --scan-file $file" root
  expect {
  "*Password:" {send "XXXXXX "}
  }
  interact
  #!/bin


  #created by mis_yw 2013-11-30
  #verify virus.
  file=$1
  if [[ ! -e $file ]] ;then
  #echo "$file is not exsit."
  echo no
  exit 0
  fi
  infected=`.

erifyvirus $file | grep Infected | grep 0`
  if(($?)) ;then
  echo yes
  else
  echo no
  fi  
 
  
  以上就是系统大全给大家介绍的如何使的方法都有一定的了解了吧,好了,如果大家还想了解更多的资讯,那就赶紧点击系统大全官网吧。 
 
本文来自系统大全http://www.win7cn.com/如需转载请注明!推荐:win7纯净版