Skip to content

Commit

Permalink
Update locate.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
fulln authored Sep 3, 2020
1 parent bfbfbc3 commit a5835ab
Showing 1 changed file with 36 additions and 23 deletions.
59 changes: 36 additions & 23 deletions ssh_script/locate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,56 @@ username=""
passwd=""
location=""

## 计数器
index=1
## 未输入参数
if [ -z "$1" ];
then
echo "Usage: will be used default params"
hostip="${hostip}24"
else
echo "listing args with \$*:"
for arg in $*
do
echo arg: $index = $arg
if [ $index == 1 ];
then
else
while getopts ":ip:name:pass:pack:" arg
do
case $arg in
ip)
len=$arg|wc -c
if [ ${len} >4 ];
then
hostip="$arg"
else
hostip="$hostip$arg"
fi
elif [ $index == 2 ];
then
;;
name)
username=$arg
elif [ $index == 3 ];
then
passwd=$arg
else [ $index == 4 ];
location=$arg
fi
let index+=1
done
echo

;;
pass)
passwd=$arg
;;
pack)
location=$arg
;;
?)
echo "未知参数"
;;
esac
done
fi

echo $hostip $username $passwd $location
case $location in
"trans")
location="es-cabinet-transfer"
;;
"act")
location="fcbox-activity-core"
;;
"op")
location="fcbox-oplatform-admin"
;;
?)
echo "未知参数"
exit 22;;
esac

expect /Users/fulln/opt/sampleScrips/ssh_script/login.exp $hostip $username $passwd $location
echo $hostip $username $passwd $location

expect $PWD/login.exp $hostip $username $passwd $location

0 comments on commit a5835ab

Please sign in to comment.