`
argo-jason
  • 浏览: 969 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

linux常用脚本

阅读更多

自动登录expect脚本,login.exp

#!/usr/bin/expect -f
#auto ssh login
set timeout 30
spawn ssh -p 22 -l root 100.100.100.100
expect {
    "yes/no" {send "yes\r"}
    "password:" {send "daydayup\r"}
}
interact



文本替换shell

#!/bin/bash

for i in `find $1 -name "*.html"`
do
  echo $i
  if [ -f $i ];then
    sed -e "s/$2/$3/g" $i >tmp.txt
    if [ $? -eq 0 ];
    then
      echo "$i is replaced!"
      cp -f tmp.txt $i
    else
      echo "$i failed"
    fi
  fi
done
if [ -f tmp.txt ];then
  rm -rf tmp.txt
fi

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics