#!/bin/sh if [ $# != 2 ] ; then echo "USAGE: $0 remote_ip serverXXXXX" echo " e.g.: $0 1.2.3.4 serverxxxx" exit 1; fi host_ip=$1 server_port=$2 user_name="user_name" password="password" server_path="/xx/xxx" src_path="${server_path}/${server_port}" ###fork expect send password and exec scp command expect << EOF set timeout 30 spawn scp -r $src_path $user_name@$host_ip:$server_path expect "password:" send "${password}\r" expect eof EOF
这样显得精简一些,专业一点。。
来深圳学习环境三周啦,这周应该差不多可以回上海啦~~