Skip to content

Commit

Permalink
add comment fixed #5
Browse files Browse the repository at this point in the history
  • Loading branch information
lonecloud committed May 16, 2019
1 parent 81ee74b commit fd57502
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ git clone git@github.com:lonecloud/ssh-tools.git
1. 机器类型范围值:0 直接连接机器,1. 跳板机 2.目标机
2. ssh中的用户名以及IP(设置端口,非必填): eg:username@ip [:port]
3. 密码
4. 备注,非必填选项

```bash
0 root@192.168.209.10:2315 123456
1 root@192.168.209.11 123456
2 root@192.168.209.12:223 123456
0 root@192.168.209.10:2315 123456 这个是直连机器
1 root@192.168.209.11 123456 这个是跳板机器
2 root@192.168.209.12:223 123456 这个是通过跳板后的目标机器
0 root@192.168.209.13 123456
```

Expand Down
6 changes: 3 additions & 3 deletions data/ssh.dat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0 root@192.168.209.10 123456
1 root@192.168.209.11 123456
0 root@192.168.209.10 123456 直连机器1
1 root@192.168.209.11 123456 跳板机
0 root@192.168.209.12 123456
2 root@192.168.209.13 123456
2 root@192.168.209.13 123456 目标机2
5 changes: 3 additions & 2 deletions ssh-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ STEP_FILE=$BASE_PATH/exp/step.exp
TYPE_ARR=($(awk '{print $1}' $DATA_FILE))
HOST_ARR=($(awk '{print $2}' $DATA_FILE))
PASS_ARR=($(awk '{print $3}' $DATA_FILE))
COMMENT_ARR=($(awk '{print $4}' $DATA_FILE))
FORWARD_ARR=($(awk 'BEGIN {i=0}{if($1 !~ /^#/) i+=1} END {print $3}' $DATA_FILE))
FORWARD_ARR=($(awk 'BEGIN {i=0}{if($1 !~ /^#/) i+=1} END {print $4}' $DATA_FILE))
DEFAULT_TYPE=$1
Expand All @@ -30,7 +31,7 @@ function splitAddr(){
function printList(){
for (( i = 0; i < $arr_len; i++ )); do
if [[ ${TYPE_ARR[$i]} -eq $1 ]]; then
echo "$i ${HOST_ARR[$i]}"
echo "$i ${HOST_ARR[$i]} ${COMMENT_ARR[$i]}"
fi
done
echo 请输入你需要直接进入的服务器
Expand Down Expand Up @@ -104,7 +105,7 @@ case "$type" in
;;
*)
#其它输入
echo "output error,please input 1/2/2"
echo "output error,please input 1/2"
;;
esac

0 comments on commit fd57502

Please sign in to comment.