目录
法1:scp命令扩展
脚本:
vim ./scp_ex.sh
#!/bin/sh
arg_index=0
start_index=0
all_arg=($*) #($*) all args
for arg in $@
do
((arg_index++))
dot_num=$(echo $arg |awk -F '.' '{print NF-1}')
if [ ${dot_num} -eq 3 ]; then #182.200.31.55 IP addr has 3 dots
start_index=${arg_index}
break
fi
done
if [ $start_index -eq 0 ]; then
echo "No host,exit."
fi
arg_index=1 #arg index is start from 1
while [ $arg_index -lt $start_index ] #-lt less then
do
arg_arr[$arg_index - 1]=${all_arg[$arg_index - 1]}
((arg_index++))
done
while [ $start_index -le $# ] #-le less then or equel to
do
echo "scp "