diff --git a/tools/easzctl b/tools/easzctl index e3d6113..e2846f1 100755 --- a/tools/easzctl +++ b/tools/easzctl @@ -304,7 +304,7 @@ function start-aio(){ if [[ -z $HOST_IP ]];then # easzctl runs in a host machine, get host's ip HOST_IF=$(ip route|grep default|cut -d' ' -f5) - HOST_IP=$(ip a|grep $HOST_IF|awk 'NR==2{print $2}'|cut -d'/' -f1) + HOST_IP=$(ip a|grep "$HOST_IF$"|awk '{print $2}'|cut -d'/' -f1) fi set -u cp -f $BASEPATH/example/hosts.allinone.example.en $BASEPATH/hosts diff --git a/tools/easzup b/tools/easzup index 566b000..359a574 100755 --- a/tools/easzup +++ b/tools/easzup @@ -193,7 +193,7 @@ function start_kubeasz_docker() { # get host's IP host_if=$(ip route|grep default|cut -d' ' -f5) - host_ip=$(ip a|grep "$host_if"|awk 'NR==2{print $2}'|cut -d'/' -f1) + host_ip=$(ip a|grep "$host_if$"|awk '{print $2}'|cut -d'/' -f1) echo "[INFO] get host IP: $host_ip" # run kubeasz docker container